Creating a nav element with clickables that have a class while the nav bar is an id

how’s that possible? one would ovveride the other right?

What challenge/project is this question related to?

If it is for a project you have already asked about, please ask on that thread instead of creating a new one.

Thank you.

project: product landing page. user story: #5

how is it the element itself nav can have an id while it’s clickables can have a class?

Any element can have an id attribute. Any element can have a class attribute. Any element can have both an id and a class attribute.

I am going to request again that you please go back to the Basic HTML section and review the challenges before asking more questions about the projects.

Based on all your recent topics/posts, I do not believe you understand enough of the basics yet to be working on the certification projects.

even when i review i tend to not recalls as well. i have gone back to take a look

i know that one of them overrides the other if they have both

That is only applicable to styling with CSS.

https://www.freecodecamp.org/learn/responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element

 <nav id="nav-bar" class="nav-link">
     <ol>
    <li class="nav-link"><a href="https://www.apple.com/ipad/" target="blank">ipad</a></li>

You posted some code but have not commented on what the purpose of the code is or any question you may have about the code. We can not read your mind.

my mistake. ok my code which i had put id like in the previous user story conflicts when i put the class within that nav element because the coder tests are not seeing it. im wondering in that here code has some problem that i don’t know

is it asking i do an internal link?

If you cannot be specific, we cannot help you. There are people on the forum who are eager to be helpful, but they cannot do so if they have to fight just to understand what your situation is.
Before anyone can help please:

  • Provide the relevant code
  • Provide a working link to your project
  • Describe the problem in detail: What exactly is failing? How is it failing?
  • Describe the solutions you have attempted: What were you trying to accomplish? How did you expect them to work? What parts do you and don’t you understand.
  • Read the user stories carefully. Make sure you understand them. Ask specific questions if you do not.
  • Revisit the relevant parts of the curriculum Make sure that you understand them. Ask specific questions if you do not.
1 Like

yes i have adhd which leads me to kind of being not omitive but hasteful/impulsive with my response your post is helpful in letting me know what to response with.

my code nav bar that i am trying to do user story# 5 is failing that test.
the instructions are clear, yet im not seeming to see what is the problem. even the code is working.

  <nav id="nav-bar" class="nav-link">
     <ol>
    <li class="nav-link"><a href="https://www.apple.com/ipad/" target="blank">ipad</a></li>
    <li class="nav-link"><a href="https://www.apple.com/watch/" target="blank">watch</a></li>
    <li class="nav-link"><a href="https://www.apple.com/iphone-11/" target="blank">iphone</a></li>
    </ol>
  <nav id="nav-bar" >
    <ol>
    <li class="nav-link"><a href="#nav-link">ipad</a></li>
      <li class="nav-link"><a href="#nav-link">watch</a></li>
      <li class="nav-link"><a href="#nav-link">iphone</a></li>
    </ol>
    
  </nav>
  
  <p class="nav-link">iphone has cool features </p>

Can you post a link to your entire project so we can see everything at the same time?

I am unclear why you have to separate code sections above. Which one is part of the code that is failing the tests?

the nav code is failing the test

When you think about a clickable element, what do you normally think of? What I mean is what kind of elements have something you can link to? Currently, your li elements have class=“nav-link”. Yes, you can click on li elements, but since user story #5 also expects these same elements to have href attributes, what elements should really have class=“nav-link” instead?

The next issue is your href values are links to external websites. The actual user story is:

When I click a .nav-link button in the nav element, I am taken to the corresponding section of the landing page.’

This means the links will be internal to the page and not to external sites.

damn my adhd

darn i mean

<button>?

gah humbug

What element did you learn about in the HTML section of the curriculum that has an href attribute? If you do not know, you need to learn how to use your favorite search engine to look it up yourself. You must learn how to read, search, and if all else fails, ask here on the forum.

that would be <a>

right?