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

Abraham Diakite
Abraham Diakite
484 Points

How Make the text inside each list item a link.

so someone show me how to make the text inside each list a link? I'm having trouble with this. The first item should link to cake.htlm, the secong to pies.html and the third to candy.html.

Thanks

index.html
<!DOCTYPE html>
<html>
  <head>
    <title>Lists and Links</title>
  </head>
  <body>
<ul> 
  <li>Cake</li>
  <li>Pies</li>
  <li>Candy</li>


  <a href="#">cakes.htmp</a>
  <a href="#">pies.htmp</a>
  <a href="#">candy.htmp</a>
 </ul>

  </body>
</html>

1 Answer

Steven Parker
Steven Parker
231,007 Points

To make a word or phrase a link, enclose it in an anchor (a) element, and in the starting tag add a "href" property with the target location as the value. For example, to make the word "Books" into a link to "library.html":

<a href="library.html">Books</a>

In this challenge, everything is already enclosed in a list item, so each addition should also be within the list item:

<li>Books</li>                             <!-- make this a link -->
<li><a href="library.html">Books</a></li>  <!-- and you get this -->