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

HTML

Navigation

Hi, when creating a navigation is it best practice to always contain it in a div? Ive seen a ul given a class of nav, then in other instances where the ul is inside a div and the div is given the class nav?

Is it always important to add the header element?

Thanks

2 Answers

From my understanding it is a matter of preference and entirely depends on its application.

Do what works best for you and no the <header> isn't a requirement but it does help structure your page and helps other coders make sense of the code you've written so I was say its good practise to do so.

However that said there's many ways to get the same result with code so work with what works for you.

Thanks Billy. I'll move forward with something that makes more semantic sense.

I have found that a lot of people do this I believe so they can manipulate the entire nav if they want to. I have found this a lot of the time in Bootstrap for example.