The ordered list start with <ol>
tag and list items start with <li>
tag.
All the lists in HTML are marked with numbers by default.
HTML Ordered List is also known as Numbered List.
Type | Description |
---|---|
1 |
This is the default type of ordered list. In this type, the list items are numbered with numbers. |
I |
The list items are numbered with upper case roman numbers. |
i |
The list items are numbered with lower case roman numbers. |
A |
The list items are numbered with upper case letters. |
a |
The list items are numbered with lower case letters. |
In this below example of HTML ordered list that displays 4 topics in numbered list and we are not defining type="1
" because it is the default type.
<ol>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>PHP</li>
</ol>
type="I"
The below example indicates how the list display in roman number uppercase.
<ol type="I" >
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>PHP</li>
</ol>
type="i"
The below example indicates how the list display in roman number lowercase.
<ol type="i" >
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>PHP</li>
</ol>
type="A"
The below example indicates how the list display in alphabet uppercase.
<ol type="A" >
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>PHP</li>
</ol>
type="a"
The below example indicates how the list display in alphabet lowercase.
<ol type="a" >
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>PHP</li>
</ol>
The start attribute is used to specify from where to start the list items in order with ol tag.
<ol type="1" start="5">
: It will display numeric values starting with "5".
<ol type="A" start="5">
: It will display capital alphabets starting with "E".
<ol type="a" start="5">
: It will display lower case alphabets starting with "e".
<ol type="I" start="5">
: It will display Roman upper case value starting with "V".
<ol type="i" start="5">
: It will display Roman lower case value starting with "v".
<ol type="i" start="5" >
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>PHP</li>
</ol>
As it named indicates it's a boolean attribute of HTML <ol> tag and it's introduced in HTML5 version.
if we used the reversed attribute with tag then it will show the numbered the list in descending order (7, 6, 5, 4......1).
<ol reversed >
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>PHP</li>
</ol>
Element | Chrome | IE | Firefox | Opera | Safari |
---|---|---|---|---|---|
<ol> | Yes | Yes | Yes | Yes | Yes |