Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Basics Going Further with HTML Links and Paths Challenge

cant figure this one out

for some reason /#portfolio doesnt work

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

2 Answers

You should remove / and just write #portfolio.

Let me explain you why this doesn't work: The HTML <a> tag is used for creating a hyperlink to either another document, or somewhere within the current document. when you want to link to another document according to location of other documents you should use / to accesses that document. for example we have document2.html in documents folder. So we should write:

 <a href="/documents/document2.html">Document 2</a>

but when you want to link to somewhere within the current document you should simply set an id for that that particular part and you have access to it by #. in this case:

<li><a href=#portfolio">Portfolio</a></li> 

if you want to learn more, check My Knowledge

vinona weil
seal-mask
.a{fill-rule:evenodd;}techdegree
vinona weil
Front End Web Development Techdegree Student 1,224 Points

Challenge : 1: For Path. Answer 1: <img src="../img/logo.png alt="Site logo">

2: to add root path just use / Answer 2: <li><a href="/">Home</a></li>

3: for navigation use # symbol Answer 3: <li><a href="#portfolio">Portfolio</a></li>