SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2007
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    The IE7 Z-index bug

    Hello,

    I think I might be the victim of the IE7 index bug. Here is the page: http://www.dependablewebhost.com/~equinoxv

    As I understand it, the z-index declaration in combination with a position:relative, is interpreted by IE7 in a way that it creates separate index contexts for each element. One fix that is suggested is to give the containing element a higher index than it's children. I've tried that on #container but it didn't seem to help.

    Any suggestions would be appreciated. I've stared at it until I'm dizzy.

    All the best,

    Luciano

  2. #2
    Ripe Tomatos silver trophybronze trophy Rayzur's Avatar
    Join Date
    Jun 2007
    Location
    Texas
    Posts
    4,174
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Actually you are the victim of an IE float bug. To get the .componentheading to sit beside the floated sidebar you will need to float it also for IE.

    Those dreamweaver templates always cause problems with IE.

    You have a large left padding set on that div.componentheading to keep the BG image extending under the sidebar so that will add to the width and throw the float off. You can fix that by setting a negative left margin to drag it under the sidebar.

    There are a couple of other changes needed as well and I will highlight them.

    Code:
    td.contentheading, div.componentheading {
        background: url(../images/pageheader-bg.gif) repeat-y top right;
        position: relative;
        z-index: 2;
        color: #f8e7b4;
        font-family: Georgia;
        font-size: 1.9em;
        line-height: 1.2em;
        letter-spacing: -.03em;
        padding: 4px 20px 8px 265px;
        width: 535px;
        float:right;/*float it right so we can use clear:right for the #topnav*/
        margin-left:-258px;/*drag it under the floated sidebar*/
        margin-bottom:-12px;/*allow topnav to slide up under*/
    } 
    
    
    
    div#topnav {
        font-family: Georgia;
        font-size: 0.85em;
        line-height: 1.4em;
        color: white;
        clear:right;
        width: 518px;
        padding: 26px 14px 14px 14px;
        margin: 0 10px 20px 260px;/*-12px 10px 20px 260px;*/
        position: relative;
        z-index: 1;
        background-image: url(../images/topnav-bg.png);
        background-repeat: no-repeat;
        background-position: right 12px;
        background-color: #8eb482;
        /* The next line makes rounded corners in compatible browsers */
        -moz-border-radius: 12px; 
        -webkit-border-radius: 12px; 
        border-radius: 12px;
    }

  3. #3
    Ripe Tomatos silver trophybronze trophy Rayzur's Avatar
    Join Date
    Jun 2007
    Location
    Texas
    Posts
    4,174
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    One more thing, your list items are out of whack now in all versions of IE.
    That is due to the top padding you put on the sidebar via the IE CC in your html.

    Code:
    <!--[if IE]>
    <style type="text/css"> 
    /* place css fixes for all versions of IE in this conditional comment */
    .twoColFixLtHdr #sidebar1 { padding-top: 30px; }
    .twoColFixLtHdr #mainContent { zoom: 1; }
    /* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
    </style>
    <![endif]-->
    Just remove that IE CC completely from the html and then set "haslayout" on the #mainContent in your default.css

    Code:
    .twoColFixLtHdr #mainContent { 
        margin: 0 0 0 248px; /* the left margin on this div element creates the column down the left side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
        padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
        color: #353535;
        min-height:0;/*IE7 haslayout*/
    } 
    * html #mainContent {height:1%;}/*IE6 haslayout*/
    Now clean up some of the sidebar ul styles -
    Code:
    div#sidebar1 ul {
        margin:0;
        padding: 45px 0 0 0;
        list-style:none;
    }
    div#sidebar1 ul li {
        display:block;
        width: 154px;
        height: 40px;
        background:url(../images/leftnav-li-bg.png) no-repeat;
        margin: 0 0 0 15px; 
        /*padding:0;*/
        text-align: center;
    }
    
    div#sidebar1 ul li a {
        display: block;
        width:100%;
        color: #000;
        text-decoration: none;
        /*margin: 0 0 0 9px;*/
        padding:15px 0 10px 0; 
        font-variant: small-caps;
        font-size: 16px;
    }
    I would also get rid of that height on the sidebar and make it min-height instead.
    Code:
    .twoColFixLtHdr #sidebar1 {
        float: left; /* since this element is floated, a width must be given */
        width: 228px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */
        min-height:483px;/*allow it to expand while holding it open for BG image*/
        background: url(../images/leftnav-bg.png) no-repeat;
        padding: 0 10px 15px 20px;
        /*margin:0;*/
        z-index: 3;
        position: relative;
    }
    All those changes plus the ones in my previous post get all browsers looking the same for me.

    If you look through all those changes you will also notice I used the shorthand property for all your backgrounds. It will reduce your file size so it is good to learn how to use it.

  4. #4
    SitePoint Guru Chroniclemaster1's Avatar
    Join Date
    Jun 2007
    Location
    San Diego, CA
    Posts
    784
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, a fairly minor point compared to everything Rayzur has fixed , but it's recommended that you use conditional comments in IE not to issue embedded CSS, but to add a link tag to an IE specific stylesheet(s).

    Though I'll admit I used a second one to insert an IE specific JS file as well. Sue me.
    Whatever you can do or dream you can, begin it.
    Boldness has genius, power and magic in it. Begin it now.

    Chroniclemaster1, Founder of Earth Chronicle
    A Growing History of our Planet, by our Planet, for our Planet.

  5. #5
    SitePoint Zealot
    Join Date
    Nov 2007
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Folks,

    Thanks so very much for your assistance. I have implemented the first two fixes for the td.contentpaneopen and #topnav and those seem to work quite spendidly. I am taking some time to learn from what you have given me as well. Here in Vermont it is way past happy hour on a Friday, so I will tidy up the navigation tomorrow.

    Thanks again.

    All the best,

    luciano


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
  •