HTML Tag Reference - HTML tag <ol>








This <ol> element creates an indented ordered list. This element is used in conjunction with the <li> element, which creates each item in the list.

Browser compatibility

<ol> Yes Yes Yes Yes Yes

What's new in HTML5

The "compact" attribute is not supported in HTML5.

The "start" and "type" attributes are deprecated in HTML 4.01, but are supported in HTML5.

The "reversed" attribute is new in HTML5.

Attribute

Attribute Value Description
compact compact Not supported in HTML5.
render the list smaller than normal
reversed reversed Set that the list order should be descending (9,8,7...)
start number Set the start value of an ordered list
type 1
A
a
I
i
Set the kind of marker to use in the list




Global Attributes

The <ol> tag supports the Global Attributes in HTML.

Event Attributes

The <ol> tag supports the Event Attributes in HTML.

Default CSS Settings

ol {
    display: block;
    list-style-type: decimal;
    margin-top: 1em;
    margin-bottom: 1em;
    margin-left: 0;
    margin-right: 0;
    padding-left: 40px;
}




Example

A demo showing how to use <ol> tag.

<html>
<body>
     <ol>
          <li>first item</li>
          <li>second item</li>
          <li>third item</li>
          <li>fourth item</li>
          <li>fifth item</li>
     </ol><!--  w  w w.  j ava 2s .c  om-->
</body>
</html>

Click to view the demo