Summary -
In this topic, we described about the <ol> tag along with detailed example.
Ordered list in html documents. The <ol> tag used to represents an ordered list in HTML document. Ordered list is nothing but a list has logical sequence with it.
Ordered list can be numerical or alphabetical sequence. <li> tag used to define the list items in ordered list.
The tag can be specified like <ol></ol> with the list item inserted in between the opening and closing tags. An ordered list can be use below -
- decimal numbers (eg, 1. 2. 3. ... etc).
- lower case latin alphabet (eg. a. b. c. ... etc).
- upper case latin alphabet (eg. A. B. C. ... etc).
- lower case roman numerals (eg. i. ii. iii. ... etc).
- upper case roman numerals (eg. I. II. III. ... etc).
Syntax -
<ol>….</ol>
Optional Attributes -
Attribute | Description | Values |
---|---|---|
Compact | Specifies the size should be smaller than normal.Not supported in HTML5 | compact |
reversed | Specifies the list order should be descending.HTML5 attribute | reserved |
start | Specifies the starting value for the list. | Number. |
type | Specifies the type of the list marker. | 1: Decimala: Lowercase Latin alphabetA: Uppercase Latin alphabeti: Lowercase Roman numeralsI: Uppercase Roman numerals |
Example -
<!DOCTYPE html>
<html>
<head>
<title>LIST tag example.. </title>
</head>
<body>
<h6> Ordered list: </h6>
<ol>
<li>Monday</li>
<li>Tuesday</li>
<li>Wednesday</li>
<li>Thursday</li>
<li>Friday</li>
<li>Saturday</li>
<li>Sunday</li>
</ol>
</body>
</html>
Output -
Ordered list:
- Monday
- Tuesday
- Wednesday
- Thursday
- Friday
- Saturday
- Sunday