Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

What 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
STAFF
Guil Hernandez
Treehouse Teacher

@Scott - That is the correct answer. But you forgot to close your img tag.

James Barnett
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.

Thanks 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
PLUS
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
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.

Tou Yang
Tou Yang
695 Points

Hahah! 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
PLUS
Joseph Cahill
Courses Plus Student 4,739 Points

Try:

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

Ever Ordered or Unordered list needs a List Item <li></li>. Even if it is blank.