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 trialScooter D
9,611 PointsWhat am I doing wrong "ul tag"
Hey, I've had this problem before on this quiz (Code Challenge: Images and Lists). It asks "Add an empty unordered lists below the image".
Here is what my code looks like:
<!DOCTYPE HTML>
<html>
<head>
<title>Smells Like Bakin' Cupcake Company</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<img src="img/cupcake.jpg"
<ul>
</ul>
</body>
</html>
Isn't the <ul></ul> all I need?
I'm stumped, any help would be appreciated, thanks!
9 Answers
Guil Hernandez
Treehouse Teacher@Scott - That is the correct answer. But you forgot to close your img
tag.
James Barnett
39,199 Points@Joseph -
Every Ordered or Unordered list needs a List Item <li></li>. Even if it is blank.
This is actually incorrect, an empty list containing an opening and closing tag such as <ul></ul>
, <ol></ol>
or <dl></dl>
are all perfectly valid HTML.
Scooter D
9,611 PointsThanks for the response!
I actually got it to work with
<ul>
</ul>
If you look up top, my image wasn't closed with ">" after I did that it worked!
Thanks!
Joseph Cahill
Courses Plus Student 4,739 Points@Scott,
Great news! Glad you got it to work!
Joseph Cahill
Courses Plus Student 4,739 Points@James,
Thanks.
What I wonder is what you can use <ul></ul>
, <ol></ol>
, or <dl></dl>
for without <li></li>
?
I have been under the impression that <li></li>
is required. Not necessarily by <dl></dl>
of course.
James Barnett
39,199 Points@Joseph -
To quote from the HTML5 spec:
Permitted contents:
Zero or more li elements
The same is true for a ol
and in the case of a dl
it's zero or more dt
.
Joseph Cahill
Courses Plus Student 4,739 Points@James
Thanks for the information!
Tou Yang
695 PointsHahah! Had same issue. Just something so small can make you go crazy for a while. Next time I go straight to the forums.
Thanks everyone!
Joseph Cahill
Courses Plus Student 4,739 PointsTry:
<ul>
<li></li>
</ul>
Ever Ordered or Unordered list needs a List Item <li></li>
. Even if it is blank.