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

Lu Favela
seal-mask
.a{fill-rule:evenodd;}techdegree
Lu Favela
Front End Web Development Techdegree Student 14,986 Points

Im trying to create a link. What am I doing wrong? <a href="pies.html"><li>Pies</a></li>

I keep getting an error message on the code challenge.

index.html
<!DOCTYPE html>
<html>
  <head>
    <title>Lists and Links</title>
  </head>
  <body>
    <ul>

      <a href="cakes.html"><li>Cakes</a></li>
      <a href="pies.html"><li>Pies</a></li>
        <a href="candy.html"><li>Candy</a></li>
     </ul>
  </body>
</html>

2 Answers

Guadalupe,

This code challenge is trying to get you to make the text inside the list item into a link, not the li. You should use this as practice to sandwich the code. Open li, Open a, close a, close li. Just like you did with ul and the li tags to make the underscored list

<ul>
<li> <a></a> </li>
</ul>

This should give you the information you need.

Louise St. Germain
Louise St. Germain
19,424 Points

You're close - you just need to swap the order of the tags. They should be like sandwiches, so the closing </...> tags should appear in the reverse order of the way they are when you opened them. Like so:

<!-- First thing should be the list item. Then the list item is a link <a href... etc>.
Then you need to close the link </a> before you close out the list item </li>. -->
<li><a href="cakes.html">Cakes</a></li>

<!--This is a problem because it's trying to close the list item while the <a> is still open.-->
<li><a href="cakes.html">Cakes</li></a>
<!-- Also a problem for the same reason: -->
<a href="cakes.html"><li>Cakes</a></li>

Think of it like packing boxes inside of boxes. Imagine you have a big cardboard box and a small cardboard box. First you need to open the big box. Then you open a smaller box and put it inside the bigger box. But you need to close the smaller box and tape it shut, before you close the bigger box and tape that shut. If you close the big box first, you will run into a problem when you then try to close the small box, because you can't reach it!