How to make an HTML nested list?

Spread the love

Sometimes, we want to make an HTML nested list.

In this article, we’ll look at how to make an HTML nested list.

How to make an HTML nested list?

To make an HTML nested list, we put the ul element inside an li element.

For instance, we write

<ul>
  <li>Choice A</li>
  <li>
    Choice B
    <ul>
      <li>Sub 1</li>
      <li>Sub 2</li>
    </ul>
  </li>
</ul>

to add the ul element inside the 2nd li element.

Then we the ul will be rendered as a nested list on the page.

Conclusion

To make an HTML nested list, we put the ul element inside an li element.

Leave a Reply

Your email address will not be published.