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

Add a nested ordered list to the "Shapes" list item.

Hi there, please help me, I don't know what I'm doing wrong.... (I've added circle and circles)

<ul> <li>Shapes</li> <ol> <li>circle</li> <li>circles</li> </ol> <li>Colors</li> </ul>

So I had it like this:

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

But it should be like this - don't close the first <li> until after the nested <ol>:

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

3 Answers

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

To nest a list inside another list, you need to enclose the new list before the closing </li> tag of the parent list item. For example:

<ul>
  <li>Shapes
      <ol> <!-- this is the nested list. You place it INSIDE the "shapes" list item -->
          <li>Square</li>
          <li>Circle</li>
      </ol>
  </li> <!-- this is the closing tag for shapes -->
  <li>Colors</li>
</ul>

Something like this

    <ul>
        <li>Shapes
             <ol>
                  <li>I'm inside shapes! Yippeee</li>
             </ol>
        </li>
    </ul>

Hope this helps

Paste your code in...