Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Angelic Sanoy
seal-mask
.a{fill-rule:evenodd;}techdegree
Angelic Sanoy
Full Stack JavaScript Techdegree Student 6,583 Points

Z-index problem

I'm trying to understand why the z-index doesn't work. I tried both relative and absolute position

This is the link

See the image here link The dropdown menu is hidden

1 Answer

Steven Parker
Steven Parker
231,248 Points

The z-index value only affects items that share the same positioning context. Elements in a higher-priority context will appear on front of those in a lower context regardless of z-index values.

One quick trick to move something to the front is to give it fixed positioning. Otherwise you might have to juggle the positioning contexts used on the page.

For more details see the MDN page on Positioning.