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.

CSS CSS Flexbox Layout Building a Layout with Flexbox Creating a Sticky Footer with Flexbox

How to make a **fixed** navigation menu with "display: flex;"

I tried setting my navigation's position to fixed but it doesn't seem to work. I did some research and it says it's impossible to do so. Is it true?

2 Answers

Mikkel Rasmussen
Mikkel Rasmussen
31,769 Points

Yes, it is definitely possible to make a fixed navigation with flexbox :)

Please take a look at this snippet showing a fixed navigation with flexbox: https://jsfiddle.net/0bv04rso/13/

If you got any question regarding the code (not my code, but will do my best to answer) please let me know and I will try to explain what is happening :)

Thank you so much ^_^!! I could understand how it works by reading the code.

Aurelian Spodarec
Aurelian Spodarec
10,789 Points

It's very simple

Just write

position: fixed;

and whala!

Sure :).