Skip to content Skip to sidebar Skip to footer

Why Z-index Is Not Working?

I have this HTML code:

Solution 1:

Just manually set the #right-block position :

#right-block {
    position: relative;
    float: right;
    background-color: blue;
    height: 50px;
    z-index: 5;
}

z-index only woks on absolute|relative|fixed positioned elements, and the default value is for position is static.

Solution 2:

I think you have some max height/width, so just write some CSS to #logo

#logo {
    position: absolute;
    z-index: 1;
    width: 100px; /* your maximum in width */height: 100px; /* your maximum in height */overflow: hidden; /* just to make sure there is nothing leaking your DIV */
}

Post a Comment for "Why Z-index Is Not Working?"