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 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,772 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,801 Points

It's very simple

Just write

position: fixed;

and whala!

Sure :).