Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Norman Dubois
Courses Plus Student 1,767 PointsFixed navigation bar under a header section
Hi all,
i want a navigation bar for a single page website which is positioned under my header section. I want that, if i scroll down, my navigation will be fixed at the top of my browser window. But it should only be fixed if i scroll down. How could i handle this?
Thanks!:)

Andrew Stelmach
12,583 PointsGiving the nav element position: fixed; in your CSS should do it.
4 Answers

Mark Josephsen
8,803 PointsYou could do it like this:
<div class="footer">
<!-- footer content here -->
</div>
.footer {
position: fixed;
bottom: 0;
}

Logan R
22,989 PointsI have never personally done this, but I do know you need to use JavaScript or JQuery to accomplish this.
This might help you out with your problem: http://stackoverflow.com/a/6981076

Norman Dubois
Courses Plus Student 1,767 PointsCool, that's the solution! Thanks!! :) It's really cool and i will try it next week at work:)

Mark Josephsen
8,803 PointsHooray! If you don't mind, could you click "Best Answer" for me? It's worth a few points...
Thanks!

Norman Dubois
Courses Plus Student 1,767 PointsYes, it's a large site. That's because I need a navbar :)
Wayne Priestley
19,567 PointsWayne Priestley
19,567 PointsHi Norman, I'm just curious as to why you want a navbar for a single page site? Is it a very long page and you wish to be able to jump from section to section?