Home

Lists in HTML

Lists are a great way to organize and present related information in a structured way. HTML supports both unordered and ordered lists.

Unordered Lists

Unordered lists display items with bullet points. Use the <ul> tag along with <li> for each item.


<ul>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ul>
    

Ordered Lists

Ordered lists display items with numbers. Use the <ol> tag along with <li> for each item.


<ol>
  <li>Step 1</li>
  <li>Step 2</li>
  <li>Step 3</li>
</ol>
    

Nesting Lists

You can nest lists inside one another to create sub-lists. Here's an example of a nested unordered list:


<ul>
  <li>Item 1
    <ul>
      <li>Sub-item 1</li>
      <li>Sub-item 2</li>
    </ul>
  </li>
  <li>Item 2</li>
</ul>
    

Exercise

Create both an unordered and ordered list in your HTML file. Try nesting one list inside another.