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.
<ol> |
Yes | Yes | Yes | Yes | Yes |
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 | 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 |
The <ol> tag supports the Global Attributes in HTML.
The <ol> tag supports the Event Attributes in HTML.
ol { display: block; list-style-type: decimal; margin-top: 1em; margin-bottom: 1em; margin-left: 0; margin-right: 0; padding-left: 40px; }
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>