j.silver Posted October 26, 2015 Share Posted October 26, 2015 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 More sharing options...
Ingolme Posted October 26, 2015 Share Posted October 26, 2015 If the element it's inside has a background color or image, then it will be behind that background. Link to comment Share on other sites More sharing options...
j.silver Posted October 27, 2015 Author Share Posted October 27, 2015 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 More sharing options...
Ingolme Posted October 27, 2015 Share Posted October 27, 2015 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 More sharing options...
j.silver Posted October 27, 2015 Author Share Posted October 27, 2015 Many thanks Ingolme. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now