Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Chrome not respecting z-index

Tags:

As per the title, it seems only Chrome isn't playign along. Note that form fields cannot be clicked on which are on the left portion of the screen. This only occurs on some pages (such as the Contact page). It appears that the #left_outer div is overlaying the content. When I edit the css via Firebug or Chrome's dev toools, it works, when I edit the actual css and refresh, it does not.

Any ideas?

LINK:

Thanks!

like image 868
vulgarbulgar Avatar asked Jun 15 '11 23:06

vulgarbulgar


People also ask

Why your Z-index is not working?

You set z-index on a static element By default, every element has a position of static. z-index only works on positioned elements (relative, absolute, fixed, sticky) so if you set a z-index on an element with a static position, it won't work.

Do you need position absolute for Z-index?

Note: z-index only works on positioned elements (position: absolute, position: relative, position: fixed, or position: sticky) and flex items (elements that are direct children of display:flex elements).

What is Z-Index 9999?

In CSS code bases, you'll often see z-index values of 999, 9999 or 99999. This is a perhaps lazy way to ensure that the element is always on top. It can lead to problems down the road when multiple elements need to be on top.


2 Answers

Usually when you have set the z-index property, but things aren't working as you might expect, it is related to the position attribute.

In order for z-index to work properly, the element needs to be "positioned". This means that it must have the position attribute set to one of absolute, relative, or fixed.

Note that your element will also be positioned relative to the first ancestor that is positioned if you use position: absolute and top, left, right, bottom, etc.

like image 140
markt Avatar answered Nov 13 '22 17:11

markt


Without a link to look at, it's a bit tough to see what the problem might be.

Do you have a z-index: -1; anywhere (a negative number is the key here, doesn't matter the number)? I have found in the past this renders the container void from being interacted with.

Good luck!

like image 33
Kate Avatar answered Nov 13 '22 17:11

Kate