PDA

View Full Version : z-index or layers?



cgweaver
01-09-2006, 10:24 PM
I have a script that displays images. I would like it to display these images behind a static image (<img src=...). I've tried putting both within a common div and each separately within their own divs then setting their z-indexes to different values, but that didn't work.

Can anyone tell me how to do this?

jscheuer1
01-10-2006, 07:59 AM
The z-index property generally only applies to absolute or relative positioned elements:


<div style="position:absolute;z-index:50;"></div>

If you give the elements in question one of these position values, it should work. However, I cannot be responsible for coding errors I cannot see, so it would be best if you could post a link to your page.

12345c
01-10-2006, 09:46 AM
I have a script that displays images. I would like it to display these images behind a static image (<img src=...). I've tried putting both within a common div and each separately within their own divs then setting their z-indexes to different values, but that didn't work.


You may appoint z-index in JS (document.all.yourIdOfImage.style.zIndex=5; ), but negative z-index work in IE (, Opera?) only. For Gecko browsers you must appoint positive z-index (in CSS or JS; default =0; ) to static image, then lesser value to behind image.