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 Getting Started with HTML Lists and Links Challenge

james chhun
james chhun
5,932 Points

setting href attribute to an anchor

my challenge is setting a link to a unordered list. I must set "href" attribute to an anchor.

index.html
<!DOCTYPE html>
<html>
  <head>
    <title>Lists and Links</title>
  </head>
  <body>
  <ul>
  <li><a href = "cakes.html">Cakes</li>
  <li><a href = "pies.html">Pies</li>
  <li><a href = "candy.html">Candy</li>
  </ul>  
  </body>
</html>

1 Answer

Abbey Tipton
Abbey Tipton
16,846 Points

Hello there! Remember that (almost) anything you open in HTML must also be closed. Just like you opened your list items with <li> and closed them with </li>, you need to close your link tags after the text you want to show. Such as:

  <li><a href="cakes.html">Cakes</a></li>

I hope that helps!

Eric M
Eric M
11,545 Points

Hi Abbey, I've changed this to an answer as it's very helpful for this question. This is just in case people are looking for unanswered questions to help with :)