Where do I put this nav tag?

User Story #8: I can see a nav element with a corresponding id="navbar" .
Where do I put this nav tag for the Techincal Website challenge?
https://codepen.io/danambitous/pen/gOabEZe

Is the place I put it right? the challenge also says that there needs to be a <header> element which would contain the text, but wouldn’t <a href="#"> Text here </a> work?

Hello!

Are you having problems with the challenge? If not, then the nav can go anywhere you want. The idea of a nav is to provide navigation and that navigation can go in the header (and a header can go inside section) or in the sidebar inside an aside element.

If you’re worried about how the challenge will find it, then you just have to provide the id and the test will work :slight_smile::

<nav id="navbar">
<!-- put your links here -->
</nav>

Is the place I put the <nav> element good? The challenge also asks me to put a <header> element to put text in, but I’m not sure how that would look. So can’t I just do this <a href="#"> Text Here </a>?

Nvm it’s just a title. Edit actually then I put it my score went down by a point. Edit again I put nav under the <header> like you did and my score didn’t went down.

1 Like

Yes, it’s one of the places it can go, but I would put it inside a header if it’s meant to be a navigation for the entire section. If it’s meant to be the main navigation, then it should go inside a header at the top of the page, where it attracts attention and/or ease of use. Always place yourself on the shoes of the user, how she would interact, how easy it’s for her to reach the content on your website.

You could put a header inside a section tag and there put text:

<body>
  <header id="header">
    <nav id="navbar">
      <a href="#">Link to some place</a>
    </nav>
  </header>
  <main>
    <section>
      <header>
        Neque porro quisquam est qui
      </header>
      <p>Blah blah blah...</p>
    </section>
  </main>
</body>

That’s up to you :slight_smile:, that’s what CSS is for.

Do I put it under #main-doc or #About_HTML. which is below the former id?

The challenge doesn’t require you to put it somewhere specifically, but, to be sure, I would put it under the #main-doc.

I changed <nav>'s place to under #main-doc, then I filled it in as said in this User Story.

User Story #13: When I click on a navbar element, the page should navigate to the corresponding section of the main-doc element (e.g. If I click on a nav-link element that contains the text “Hello world”, the page navigates to a section element that has that id and contains the corresponding header . Also in the test the error is 4.

And all links do work, but my score didn’t increase from 10, I wonder why?

below the failed test (it’s always a good thing to check there to know why the test is failing) there is written

Some "main-section" elements are missing the following ids (don't forget to replace spaces with underscores!) : EXAMPLES_OF_HTML_TAGS,EXAMPLES_OF_HTML_ATTRIBUTES

check if you have written all ids correctly

I got it a fixed, it was a typo. Thanks everyone for the help.

The idea of a nav is to provide navigation and that navigation can go in the header (and a header can go inside section) or in the sidebar inside an aside element. If you’re worried about how the chal…