HTML HTML Basics Going Further with HTML Links and Paths Challenge

Fortune Venekerai Gumbo
Fortune Venekerai Gumbo
5,138 Points

how do i set the "main" link to navigate to the section of the page with the id main.

index.html
<!DOCTYPE html> 
<html>
  <head>
    <title>Portfolio Page</title>
  </head>
  <body>
    <img src="../img/logo.png" alt="Site logo">
    <ul>
      <li><a href="/">Home</a></li>
      <li><a href="">Portfolio</a></li>

    </ul>
    <h1 id="#portfolio">My Portfolio</h1>

  </body>
</html>

2 Answers

Christina Pagano
Christina Pagano
12,647 Points

First, when assigning ids to elements, you don't include the # symbol. So your h1 element should be

<h1 id="portfolio">My Portfolio</h1>

So the same would apply to assign an element the ID "main". To link to these elements on the page, set your anchor tags' href attribute to the section's id, with the # symbol included.

<a href="#main">Main Content</a>
<section id="main">
<!-- content here -->
</section>