Jump to content
Sign in to follow this  
j.silver

Element Disappearing Because of Negative Z-index

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?

Share this post


Link to post
Share on other sites

If the element it's inside has a background color or image, then it will be behind that background.

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...