HTML HTML Basics Going Further with HTML Links and Paths Challenge

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

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

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


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 -->

thank you very much

<h1 id="#main">go to main content</h1>