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

Placement of the <nav> element.

My question is more regarding the "nav" element itself.

In the video, the "nav" element is nested inside of the "header" tags, which prompted the following questions in my head:

1.) Was Nick's decision to place <nav> in the <header> tag best practice or a personal preference?

2.) Is there a situation where a designer would place the <nav> outside of the <header> vs. inside?

I do intend to try both once I log off for the evening, just wanted to get a sense of the pros vs. cons of doing so or if that was simply personal preference.

1 Answer

Chris Shaw
Chris Shaw
26,676 Points

Hi Rozario,

The choice to put the nav element in the header element would have come down to the design of the website and how certain elements needed to interact with each other along with some best practices, the nav element itself can be used anywhere within your code as it has no restrictions.

One thing this course didn't cover is the use of role attributes in which give meaning to elements such as nav allowing for specificity and basic accessibility support but you can read more about them at the below link.

http://www.w3.org/TR/role-attribute/

Thank you kindly! I will check out the link as well!