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 How to Make a Website Creating HTML Content Use the Navigation Element

Natalia P.
Natalia P.
353 Points

Why do you have to use a <nav> element?

Why when making a list of the different sites in your web page do you have to use the nav element? Why can't you just make a list?

Also, if I were to make a list of links that are outside of a web page could I just use a <list> element? For example, I have a website about my company, and then I want to include some governmental information about my company's product line by throwing in a couple links. Would I need to use the nav element then or is that only for when I link sites within my own website? Thank you.

Source W3C:

Not all groups of links on a page need to be in a nav element — the element is primarily intended for sections that consist of major navigation blocks. In particular, it is common for footers to have a short list of links to various pages of a site, such as the terms of service, the home page, and a copyright page. The footer element alone is sufficient for such cases; while a nav element can be used in such cases, it is usually unnecessary.

User agents (such as screen readers) that are targeted at users who can benefit from navigation information being omitted in the initial rendering, or who can benefit from navigation information being immediately available, can use this element as a way to determine what content on the page to initially skip and/or provide on request.

Hope that helps ^_^

3 Answers

Natalia, there's some debate on whether to use lists in navigation or not.

Natalia P.
Natalia P.
353 Points

Thank you! I left you another question in the previous question you answered if you don't mind helping me out again. Thank you.

Hi Natalia, the <nav> element was introduced in the HTML5 specification as a better way to organize content. Before the <nav> element, it was more common to use the <div> element to organize blocks of content. HTML5 provides a more semantic, cleaner approach to structure web content.

The nav element represents a section of a page that links to other pages or to parts within the page: a section with navigation links. Not all groups of links on a page need to be in a nav element only sections that consist of major navigation blocks are appropriate for the nav element. In particular, it is common for footers to have a list of links to various key parts of a site, but the footer element is more appropriate in such cases, and no nav element is necessary for those links. —HTML5 specification via HTML5 Doctor

Natalia P.
Natalia P.
353 Points

Thanks Dustin. What would you consider a "major" navigation block then? Is it the number of links? Or something else? Is there an advantage to using the navigation element over just leaving it as links? Thanks.

Liam Sullivan
Liam Sullivan
1,805 Points

You don't IT IS USELESS