Jump to content

Element Disappearing Because of Negative Z-index


j.silver

Recommended Posts

Dear all:

 

I have a header with 60% width occupied by a video, to the right of which is an aside section taking the remaining 40%. The aside section has three items fixed horizontally on top of each other. So the header has four elements in total. To account for possible overlaps between the four elements, I declared a z-index of -1 to the top right element, with the rest elements getting z-index 1 to 3. Then the element with z-index -1 disappeared. I then gave it z-index 1 and gave the others 2-4. Why has z-index -1 caused the element to disappear?

Link to comment
Share on other sites

So does that mean z-index -1 is for hiding elements behind other elements or colors, and that to rank elements in terms of priority for overlapping one should use positive values for z-index?

Link to comment
Share on other sites

A negative z-index means that the element is behind its parent. If you want it to still be visible, you would need to remove any backgrounds from the parent element. Alternatively, you could keep the z-index at the default (zero) and give a higher z-index to other elements.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...