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

why nav tag and header tag is used?

Without using nav tag and header tag the output is pretty same.Sorry if my question is silly. I m new to web development

3 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points

Nav and Header are what are known at Semantics. Technically they perform the same function as a div tag.

They belong to the same group as article, aside, footer and section tags.

You could put footer content in a footer tag, your logo and other information in a header tag, and main content in your article tag. It just helps developers organise their pages better then just using endless div tags :-)

nav and header tags are both html 5 tags. we know that the output is the same if we use div tags, but it'll be more semantic to use the html 5 tags.

when exactly we need to use these tags??

The <nav> and the <header> serve different functions. The header can have various things in addition to navigation, such as a logo, a sign in menu, a notification icon.