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 -

  1. decimal numbers (eg, 1. 2. 3. ... etc).
  2. lower case latin alphabet (eg. a. b. c. ... etc).
  3. upper case latin alphabet (eg. A. B. C. ... etc).
  4. lower case roman numerals (eg. i. ii. iii. ... etc).
  5. upper case roman numerals (eg. I. II. III. ... etc).

Syntax -

<ol>….</ol>

Optional Attributes -

AttributeDescriptionValues
CompactSpecifies the size should be smaller than normal.Not supported in HTML5compact
reversedSpecifies the list order should be descending.HTML5 attributereserved
startSpecifies the starting value for the list.Number.
typeSpecifies 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:
  1. Monday
  2. Tuesday
  3. Wednesday
  4. Thursday
  5. Friday
  6. Saturday
  7. Sunday