<ol> Tag in HTML

The <ol> tag in HTML is used to create an ordered (numbered) list. It is typically used when the sequence of list items is important, such as steps in a process or ranked items.

Key Points on <ol> Tag:

Syntax of <ol> Tag:

Syntax Example

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

Example of <ol> Tag in HTML:

This example demonstrates how to create an ordered list using the <ol> tag.

Code Example


        <ol>
            <li>First item</li>
            <li>Second item</li>
            <li>Third item</li>
        </ol>
                

Output

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

Ordered List with Attributes:

In the following example, an ordered list is displayed with different types of numbering styles.

Code Example with Attributes


        <ol type="A">
            <li>Apple</li>
            <li>Banana</li>
            <li>Cherry</li>
        </ol>
                

Output with Type "A" (Uppercase Letters)

A.Apple B.Banana C.Cherry

The <ol> tag is useful for creating ordered lists, where the order of items is important. You can customize the appearance of the list with the type, start, and reversed attributes to fit your needs.