Jump to content

Z-Index with nested ULs


shadowayex
 Share

Recommended Posts

In the normal scheme of things, if a parent UL and a nested UL would overlap, the nested one would be rendered on top of the parent one (or so I've gathered from testing and readings). I want the opposite effect; I would like parent ULs to render over child ULs in a project I've begun recently. I tried setting z-indices on all of the ULs and LIs in the structure, setting the largest z-index on the root UL and working down to the last LI in the structure, but that did not seem to affect what order the ULs were rendered on one another (although the LIs now behave as desired; the first on top, the second under the first, etc.). Is there any way to break out of the nested UL being rendered on top norm and get parent ULs to be rendered on top of their children ULs?

Link to comment
Share on other sites

The z-index of a child is always relative to its parent. That means that if the z-index is positive, it will be above the parent. It it's negative, the element will be below its parent. Use negative z.index values to achieve your goal.

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
 Share

×
×
  • Create New...