Click here to Skip to main content
15,891,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
when i click an image i want to display another image on top of previous image.
Posted

1 solution

simplest solution is to create a relative div that is placed in the flow of the page; place the base image first as relative so that the div knows how big it should be; place the overlays as absolutes relative to the upper left of the first image. The trick is to get the relatives and absolutes correct.

XML
<div style="position: relative; left: 0; top: 0;">
  <img src="first.jpg" style="position: relative; top: 0; left: 0;"/>
  <img src="top.jpg" style="position: absolute; top: 30; left: 70;"/>
</div>>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900