Jump to content

overlay 2 images


dreamwest

Recommended Posts

How can i overlay 2 images without using position: absolute

 

Basically i want to overlay img2.jpg with img1.jpg, this ocde below works but floats it outside the table, i need it to site inside the table so i can put it in a while loop

 

<table><tr><td >
<div id="placeholder" style="position:absolute; left:32px; top:100px; z-index:1">
<img  class=moduleFeaturedThumb width="140" height="110" src="img1.jpg"></div>

<div id="place" style="position:absolute; left:32px; top:100px; width:160; height:130; z-index:2">
<img src="img2.jpg" width="140" height="110"></div>
</td></tr></table>

Link to comment
https://forums.phpfreaks.com/topic/160894-overlay-2-images/
Share on other sites

Its a bad practice to mix deprecated attributes with their css equivalents.

 

There is no reason to use a wrapping division, you can apply the required styles directly to the images.

 

The reason your image is positioned outside the table, rather then relatively to the edges of the td element, or parent table cell. Is because you forgot to position the cell itself.

 

 

You should position the parent element using position: relative; to enable absolute positioning relativly to the edges of that element.

Link to comment
https://forums.phpfreaks.com/topic/160894-overlay-2-images/#findComment-849183
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.