Welcome to the Treehouse Community
Looking to learn something new?
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.
Chris Shaw26,650 Points
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.