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

not sure what im doing wrong

supposed to turn the list into links but it keeps saying im wrong?

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

Have you tried swapping the

<li></li>

to wrap around the

<a>

like below

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

It might be worth trying that

1 Answer

Shay Paustovsky
Shay Paustovsky
969 Points

Hi Nicholas,

You're doing great!. Just keep a note for a few things:

  1. <a></a> - are not descendant tags of the <ul> element therefore they cannot open a list item
  2. </li> - you have a closing tag for the "list-item" tag but didn't open it.
  3. <li> <a></a> </li> - the "anchor" element must be nested inside the list-item tag in order for it to work.
<!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>

Now remember:

The 'ul' & 'ol' are both tags that markup lists in HTML. inside the list, each list item is marked up using the 'li' tag which represents a list item. the 'anchor' element cannot open a list item because it's not a descendant of it. The 'anchor' element is used to markup clickable links / hypertext links. Instead of the 'li' which wraps the hypertext link, wrap it inside '<a>' tags.

Hope I've helped you.

Sincerely & Happy Coding

Shay