Processing
 

Google Chrome and the Z-Index bug

16/10/2013 17:36#1

Joined at: 6 months ago

Post: 1

Thank: 0

Thanked: 0

I have been playing with a responsive site, and when all the menus and logos worked well in Coda, sliding nicely into place I tried the site in Chrome, and the logo seems to be hiding behind the header - any help gratefully received!

HTML

<div id="menu">    <div class="menu">       <ul>          <li><a href="#">Prices</a></li>          <li><a href="#">About</a></li>          <li><a href="#">Contact</a></li>          <li class="contact"><span>&#9990;</span><a href="#"> 0783 448 5449</a></li>       </ul>    </div> </div> <div class="container"> <div class="sixteen columns">    <div id="track">       <div class="logo"><img src="/images/logo-120.png"></div>    </div> </div> 

CSS:

#menu {     position: fixed;     top: 50px;     height: 50px;     background-color: rgba(255,255,255,0.9);     width: 100%;     border-bottom: 1px solid #ccc;     border-top: 1px solid #ccc;     -moz-box-shadow: 0 0 5px #888;     -webkit-box-shadow: 0 0 5px#888;     box-shadow: 0 0 5px #888;     text-align: center;     z-index: 3000; }  .menu ul li {     display: inline-block;     margin-left: auto;     margin-right: auto;     margin-top: 12px;     text-align: center;     vertical-align: middle;     padding: 2px 4px 2px 4px;     background-color: #fff;      130%; }  #track {     position: fixed;     top: 1px; }  .logo {     position: relative;     height: 120px;     width: 153;     top: 20px;     left: 0px;     z-index: 3500; } 
16/10/2013 18:06Top#2

Joined at: 6 months ago

Post: 1

Thank: 0

Thanked: 0

Not sure if this should be called a "bug" per-se.... it's just the way the browser handles the relationships between parent/child elements and the z-index property.

The problem is the #menu is a sibling to the .container element, not the .logo. It doesn't matter how high you put the z-index on .logo it won't go in front of the #menu because the .logo's parent (.container) will always be behind the #menu....

.container has no position or z-index

If that makes no sense, I understand. You might get a better idea from this jsFiddle http://jsfiddle.net/EpgxK/1/ and check this out as well http://css-tricks.com/almanac/properties/z/z-index/.

Oh, and you'll probably have to recode your html if you want the menu to appear in front of the logo at smaller screen sizes.

16/10/2013 17:45Top#3

Joined at: 10 months ago

Post: 43

Thank: 0

Thanked: 0

The position: fixed header needs to have a z-index of 0 (or negative) for the logo to appear above it. I think you may be missing some styles to see this problem based on what you have given us, though.

http://jsfiddle.net/ExplosionPIlls/MaDe2/1/

22/06/2016 08:23Top#4

murtuza

Member

Joined at: 10 months ago

Post: 2

Thank: 0

Thanked: 0

I Had a same issue I solve by just giving position:static instead position:relative.

In your case just change this class.

` .logo {     position: static;     height: 120px;     width: 153;     top: 20px;     left: 0px;     z-index: 3500; }` 
Similar articles

Chrome, THREE.js: Cross-origin image load denied

5 years ago - Reply: 5 - Views: 267

Prevent Google Chrome Log XMLHttpRequest

3 years ago - Reply: 5 - Views: 276

How can I include ChromeDriver in a JAR?

3 years ago - Reply: 3 - Views: 80

Chrome geolocation not working on any site

3 years ago - Reply: 1 - Views: 43

wrong borders' width in android browser

3 years ago - Reply: 4 - Views: 205

Uncaught SyntaxError: Unexpected token < On Chrome

3 years ago - Reply: 10 - Views: 462

Flashdata not getting cleared in Codeigniter

3 years ago - Reply: 5 - Views: 57

Illegal access Javascript error in Chrome

3 years ago - Reply: 1 - Views: 51

ng-repeat not updating in Chrome

3 years ago - Reply: 1 - Views: 81

Applying border to a checkbox in Chrome

4 years ago - Reply: 2 - Views: 118

open browser plugin using access vba

3 years ago - Reply: 1 - Views: 25

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re