Results 1 to 3 of 3

Thread: z-index or layers?

  1. #1
    Join Date
    Dec 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default z-index or layers?

    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?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The z-index property generally only applies to absolute or relative positioned elements:

    HTML Code:
    <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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2005
    Location
    Moscow, Russia
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by cgweaver
    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •