SimpleTuts.com

Lists in HTML

HTML provides two main types of lists: ordered lists and unordered lists.

Unordered List

An unordered list displays items in a bullet format. The <ul> element is used to create an unordered list, and each item is wrapped in a <li> (list item) tag.

Example:

Ordered List

An ordered list displays items in a numbered format. The <ol> element is used to create an ordered list, and each item is wrapped in a <li> (list item) tag.

Example:

  1. First item
  2. Second item
  3. Third item

<html>
<head>
    <title>HTML Lists</title>
</head>
<body>
    <style>
        ul.mylist {
            list-style-image: url(bullet.png);
        }
    </style>
    
    <h1>Ordered list</h1>
    <ol type="I">
        <li>Apple
            <ol type="a">
                <li>Green Apple</li>
                <li>Red Apple</li>
            </ol>
        </li>
        <li>Orange</li>
        <li>Grapes</li>
        <li>Mango</li>
        <li>Banana</li>
    </ol>
    
    <h1>Unordered list</h1>
    <ul type="disc" class="mylist">
        <li>Apple</li>
        <li>Orange</li>
        <li>Grapes</li>
        <li>Mango</li>
        <li>Banana</li>
    </ul>
</body>
</html>

Run Code