'Each .nav-link element should have an href attribute : expected false to equal true'

I don’t understand why the project console is saying this but it insists i have not included ‘href’ attributes in my code when i have and have made them internal links. Have i done something wrong?

<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>

<html>

<head>
  <title>StarWalls - Lightyears ahead</title>
</head>

<body>
  <div id="top">
  <header id="header">
    <nav id="nav-bar">
      <img id="header-img" src="https://cdn.shopify.com/s/files/1/0023/5431/5327/files/61.6KB_x100.jpg?v=1553920971" alt="star walls logo">
      <ul class="nav-links">
        <li class="nav-link"><a href="#top">Home</a></li>
        <li class="nav-link"><a href="#video">About</a></li>
        <li class="nav-link"><a href="#footer">Pricing</a></li>
      </ul>
    </nav>
  </header>
  </div>
  <br>
  <div id="section2">
    <video id="video" width="500" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
Your browser does not support video.
</video>
  </div>
  <div id="section3">
    <form id="form" action="https://www.freecodecamp.com/email-submit">
      <input id="email" type="email" name="email" placeholder="Enter email" required>
      <input id="submit" type="submit">
    </form>
  </div>
  <div id="footer">
    <div class="pricing">
      <span>Standard</span><br>
      <span>£20</span>
      <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
    </div>
    <div class="pricing">
      <span>Premium</span><br>
      <span>£35</span>
      <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
    </div>
    <div class="pricing">
      <span>Ultra</span><br>
      <span>£50</span>
      <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
    </div>
  </div>

Take another look at the wording… “Each .nav-link element should have an href attribute : expected false to equal true”

It is looking for an element that has class=‘nav-link’ & href=’?’ Your current code has an element with a href nested inside an element with .nav-link :smiley:

I see what you mean but I have to make a navbar for my project so I have to put those li elements. And since i need to link the li elements to sections of the page i nested anchor tags within them

I just don’t understand because it works - when you click on them you jump to sections of the page.

Your list item has ‘nav-link’ and your anchor has ‘href’

The test is looking for both in the same tag
<a href="target" class="nav-link">text</a>

1 Like

Yeah i just realized as i sent the reply - thanks for your help.