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 trialNicholas Fuentes
5,291 Pointsnot sure what im doing wrong
supposed to turn the list into links but it keeps saying im wrong?
<!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>
1 Answer
Shay Paustovsky
969 PointsHi Nicholas,
You're doing great!. Just keep a note for a few things:
- <a></a> - are not descendant tags of the <ul> element therefore they cannot open a list item
- </li> - you have a closing tag for the "list-item" tag but didn't open it.
- <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
Lewis Eccles
582 PointsLewis Eccles
582 PointsHave 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