Nesting a ul inside an ol

15,818

The children of lists should be list items. You have both list items and unordered lists as children of your ordered list. You need something like:

<ol>
    <li>
        <p>First numbered Item</p>
        <ul>
            <li>one thing</li>
            <li>two things</li>
            <li>three things</li>
        </ul>
    </li>
    <li>
        <p>Second numbered Item</p>
        <ul>
            <li>one thing</li>
            <li>two things</li>
            <li>Three things</li>
        </ul>
    </li>
</ol>
Share:
15,818

Related videos on Youtube

rlavoir
Author by

rlavoir

Updated on September 15, 2022

Comments

  • rlavoir
    rlavoir over 1 year

    Im trying to make an ordered list with two items, and three items under each list, which have bullet points. my code is not passing validation because it saysElement ul not allowed as child of element ol in this context. But everywhere I look it says this is ok. here is my code

    <ol>
        <li>First numbered Item</li>
            <ul>
                <li>one thing</li>
                <li>two things</li>
                <li>three things</li>
            </ul>
        <li>Second numbered Item</li>
            <ul>
                <li>one thing</li>
                <li>two things</li>
                <li>Three things</li>
            </ul>
    </ol>
    

    not sure what im doing wrong. thanks for the help, first post here :)

  • rlavoir
    rlavoir over 7 years
    Thanks! Now how do I get rid of the paragraph spacing?
  • Mick
    Mick over 7 years
    Just delete the paragraph elements. I really only included them for clarity. All that is required is that the inner lists be inside the outer list items.