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 Lists HTML Lists

Corkey Devlin
Corkey Devlin
2,634 Points

Hi, I am trying to add a nested ordered list within an unordered list. I think I'm correct but evidently not.

I'm not sure what else to add if this is pulling in my code. Thanks for your help.

index.html
<!DOCTYPE html>
<html>
  <head>
    <title>HTML Lists Challenge</title>
  </head>
  <body>

    <h1>HTML Lists Challenge</h1>

    <!-- Write your code below -->
    <ol>
      <li>Stop</li>
      <li>Drop</li>
      <li>Roll</li>
    </ol>

    <ul>
      <li>Shapes</li>
        <ol>
        <li>Circle
        <li>Triangle</li>
        </ol>
      <li>Colors</li>

    </ul>

  </body>
</html>

4 Answers

You are missing an <li> element from your code and the <ol> must be embedded in a list item itself which is why you are not getting the desired result. Here is what you should have:

<!DOCTYPE html>
<html>
  <head>
    <title>HTML Lists Challenge</title>
  </head>
  <body>

    <h1>HTML Lists Challenge</h1>

    <!-- Write your code below -->
    <ol>
      <li>Stop</li>
      <li>Drop</li>
      <li>Roll</li>
    </ol>

    <ul>
      <li>Shapes</li>
        <li>
          <ol>
            <li>Circle</li>
            <li>Triangle</li>
        </ol>
       </li>
      <li>Colors</li>

    </ul>

  </body>
</html>

EDIT: As Tuukka said, always check the W3 Validator! It's a handy tool.

Tomy Lim
Tomy Lim
4,571 Points

I agree with Marcus.

When you begin to code, you'll forget to close your tags.

As a beginner it's easy to go code blind and it's very difficult to find where the error lies. One thing that has helped me many times when I have dug myself in a hole is the HTML validator.

http://validator.w3.org/

When ever I face problems I run my html file through it, and if I'm still in the hole I start screaming for help.

Corkey Devlin
Corkey Devlin
2,634 Points

Thanks-I ended up finding the issue but thx for the validator--most appreciated.

Wayne Priestley
Wayne Priestley
19,579 Points

Hi Corkey,

What you looking for is something like this:

<ul>
  <li>seven</li>
  <li>four</li>
  <li>two</li>
  <li>
    <ol>
      <li>one</li>
      <li>two</li>
      <li>three</li>
      <li>four</li>
    </ol>
  </li>
  <li>nine</li>
  <li>three</li>
  <li>one</li>
</ul>

Hope this helps.