How can main and header be used together?

Of course, there isn’t one rule for writing HTML. However, you must be aware that <header> elements are used to wrap introductory content, they aren’t used to wrap a site header (navigation menu). This means that it would be enough to just use a <nav> element for your navigation menu

…but that’s exactly what’s done in the example.


      <h1>Navigational Links</h1>



          <li><a href="#home">Home</a></li>

          <li><a href="#posts">Posts</a></li>

          <li><a href="#contact">Contact</a></li>




Is it best practice to have the nav tag over, under or inside the header tag then?

1 Like

Again, HTML doesn’t have one solution. You’re the one who gets creative with it. However, after much research, I’ve come to the conclusion that if you are doing a navigation menu, only wrap it in a <nav> element. However, if you are also adding a header, title, or anything other than a navigation menu, wrap everything in a header, and the navigation links in a nav element

So in this lesson, not only did they add navigation links, but they also added an h1. So, you would use a header element

That’s how I think of it

Okay, it does make sense. Thanks for explaining!

1 Like

This format makes the most sense to me as well. I’m not sure what benefit anyone could see from deviating from this format.