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

turning list items into links using anchor elements

I keep typing in the correct way to turn the list items into links using anchor elements but it keeps saying its incorrect i do not understand what im doing wrong please help.

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

3 Answers

<li><a href="pies.html>Pies</a></li>

You dont have closing tag after html..

<li><a href="pies.html">Pies</a></li>

you missed closing quotes after pies.html

Joe Cooper
Joe Cooper
7,431 Points

Hi Evan,

In HTML, the smallest thing can cause an issue! And unfortunately, the computer doesn't provide a reason as to why your HTML is not working. Don't worry though, as you practice more you'll get more used to spotting errors.

In your code, you have what's known as a syntax error. This means that you've written your code incorrectly, and when it comes to syntax errors in HTML, the colors that the editor displays each part of your code in can sometimes help you!

If you look at your first list item, and take note of how each part of the code is a certain color.

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

The opening tag, attributes and the closing tag are green. The attribute value is pink. And the text in between the opening and closing tag is red.

Now, if we look at the second list item in your code.

Notice how the text in between the opening and closing tag as well as the closing tag itself is pink? This is a good indicator that something is wrong here. And if you look closely, you will see that you have forgotten a closing quotation mark right after pies.html - this is why the rest of that line is also displaying as pink, as the editor thinks that it's all part of the attributes value.

I hope that makes sense, and just so you can be sure of what I mean, the correct code is below:

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

Joe