HTML Unordered and Ordered Lists Tutorial

HTML provides list tags to create unordered (bulleted) and ordered (numbered) lists. Lists are useful for organizing content in a structured format.

1. Unordered Lists

Unordered lists are created using the <ul> tag, with list items defined inside it using <li> tags. By default, items are displayed with bullet points.


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

This example creates a simple bulleted list with three items.

Preview:
  • Item 1
  • Item 2
  • Item 3

2. Ordered Lists

Ordered lists are created using the <ol> tag, with list items specified using <li> tags. By default, items are displayed with numbers.


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

This example creates a numbered list with three steps.

Preview:

1. Step 1
2. Step 2
3. Step 3

3. Nested Lists

HTML allows you to nest lists, creating lists within lists for complex structures:


<ul>
    <li>Item 1
        <ul>
            <li>Subitem 1.1</li>
            <li>Subitem 1.2</li>
        </ul>
    </li>
    <li>Item 2</li>
</ul>
                    

This nested list example creates subitems under "Item 1" in the main list.

Preview:
  • Item 1
    • Subitem 1.1
    • Subitem 1.2
  • Item 2

4. Changing List Styles with CSS

You can customize the appearance of lists with CSS, such as changing bullet styles and numbering types:


ul {
    list-style-type: square;
}
ol {
    list-style-type: upper-roman;
}
                    

This example changes unordered list bullets to squares and ordered list numbers to Roman numerals.

Preview: This is a customized ordered and unordered list:
  • List style type square
  1. List style type upper-roman

5. Conclusion

HTML lists are powerful for organizing content. Unordered and ordered lists provide structure and visual hierarchy, making information easier to read and navigate.

Note: We aim to make learning easier by sharing top-quality tutorials, but please remember that tutorials may not be 100% accurate, as occasional mistakes can happen. Once you've mastered the language, we highly recommend consulting the official documentation to stay updated with the latest changes. If you spot any errors, please feel free to report them to help us improve.

top-home