HTML Nested lists


Example

You can nest lists to represent sub-items of a list item.

<ul>
  <li>item 1</li>
  <li>item 2
    <ul>
      <li>sub-item 2.1</li>
      <li>sub-item 2.2</li>
    </ul>
  </li>
  <li>item 3</li>
</ul>
  • item 1
  • item 2
    • sub-item 2.1
    • sub-item 2.2
  • item 3

The nested list has to be a child of the li element.

You can nest different types of list, too:

<ol>
    <li>Hello, list!</li>
    <li>
        <ul>
            <li>Hello, nested list!</li>
        </ul>
    </li>
</ol>