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.
Bartlomiej Pajak5,062 Points
Is my fixed navigation is ok?
So as additional task I want to navigation be always on the top of the page during scrolling. I have some issue while writing it but finally I achieved that result:
Here is my workspace: https://w.trhou.se/3awhi63tv4
I I was inspired knowlegde form earlier videos on this course and my question is: is this code ok or must to be done different?
Thanks in advance for your help!
Hi Bartlomiej Pajak,
I think you did a great job. You accomplished what you set out to do. Is there a better way to do the same thing? Yes. :) I say that lovingly. You had all the components needed to create a sticky navigation: position, top, and width. You also added a nice amount of top padding on the body (I see a lot of people miss this).
I didn't notice a ton of bloated/redundant code after my review and my only recommendation would be to work on your organization and commenting. I was a little confused about why you chose to nest your "sticky" declarations under the flex stylesheet. Personally, I would have included that code under base.css. Nonetheless, I think I understood what you were trying to do. Keep at it.
Here's a good resource for you for more info on this topic: Click Here