Results 1 to 2 of 2

Thread: index-z in ie6

  1. #1
    Join Date
    Aug 2010
    Posts
    47

    index-z in ie6

    <div id = "001" style="width:100px ;height:50px; border:1px solid #999; background:green; position:absolute;">001 <div id = "002" style="top:20; left:40; width:100px ;height:50px; border:1px solid #999; background:red;position:absolute;z-index:4" >002</div> </div> <div id = "003" style="top:20; left:40; width:100px ;height:50px; border:1px solid #999; background:yellow;position:absolute;z-index:2" >003</div>

    I have 3 DIV, DIV 001 and DIV 003 are top DIV, DIV 002 is the sub DIV from DIV 001.
    All the DIV position are absolute. It is not allow me to change the DIV level and position in my whole code.

    I want DIV 001 in the below, DIV 003 in the middle, DIV 002 in the top.

    I set DIV 003 with a low z-index, DIV 002 with a high z-index and not set any z-index for DIV 001. It is show correct in IE8, FIREFOX3.6, OPERA10 and Safari4, but show wrong in IE6: DIV 003 is alwways on the top of DIV 002.
    How can I do?

  2. #2
    Join Date
    Feb 2006
    Location
    Salisbury UK
    Posts
    4,332
    I haven't got time to test your code, but on this page item 1 using position: relative and item 2 using position: absolute both work in all browsers including IE6 so maybe you can learn from them.
    http://www.wickham43.net/layers.php

    Another factor is that you should never name an id or class starting with a number so #001 for id="001" or .001 for class="001" is dangerous. Always use a letter fiirst like #div001 for id="div001" or .div002 for class="div002" although I doubt if that is causing your problem.

    What happens if you put div 003 before div 002 ?
    Code:
    <div id = "001" style="width:100px ;height:50px; border:1px solid #999; background:green; position:absolute;">001 
    </div> <div id = "003" style="top:20; left:40; width:100px ;height:50px; border:1px solid #999; background:yellow;position:absolute;z-index:2" >003</div>
    <div id = "002" style="top:20; left:40; width:100px ;height:50px; border:1px solid #999; background:red;position:absolute;z-index:4" >002</div>
    Code downloaded to my PC will be deleted in due course.
    WIN7; IE9, Firefox, Opera, Chrome and Safari for Windows; screen resolution usually 1366*768.
    Also IE6 on W98 with 800*600 and IE8 on Vista 1440*900.

Similar Threads

  1. Help tweaking code, image slideshow
    By Enforcer in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 26 Nov 2009, 05:22 PM
  2. IE6 opacity problems
    By Fiasst in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 30 May 2007, 02:37 PM

Posting Permissions

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