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

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