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

Mukund Narasimhan
PLUS
Mukund Narasimhan
Courses Plus Student 9,443 Points

https://w.trhou.se/1zjwmsyei8 i am not getting my header position fixed ?

https://w.trhou.se/1zjwmsyei8 i am not getting my header position fixed ? how to fix it

1 Answer

It looks like what you have written should be working, but what you may be missing is a z-index. Once you declare a position on an element, you unlock new 'z abilities'! You can changed the 'stacking' order of the elements by applying different z-indexs (Starting at 0); so to make sure that it is staking on top of things and not falling underneath, trying applying this...

.header {
 position: fixed;
 z-index: 2;
}

Make sure that you place your declaration OUTSIDE of your media query if you want it to always be fixed.