Ordered List In HTML
Ordered List An ordered list is also a list of items. The list items are marked with numbers not with the bullets. |
|
An ordered list starts with the <ol> tag and end with </ol>. list items are defined in between <ol> & </ol>. Each list item is surrounded by the <li> & </li> tag. |
|
<ol> tag is used for ordered list. Between <ol> & </ol> you have to enter list of items. |
|
<li> tag is used for list item. Each list item is surrounded by <li> & </li> tag. |
|
|
Format: |
<ol> <li> item1 </li> <li> item2 </li> …….<li> itemn </li></ol> |
|
Example |
Output |
<ol>
<li>Text Book</li><li>Note Book</li>
<li>Pen</li><li>Pencil</li>
</ol>
|
- Text Book
- Note Book
- Pen
- Pencil
|
|
|
Just write/copy this example inside the body of the HTML file and save the file and open in the browser and see how it looks. |
|
So now you have learned how to create the ordered list in the web page. More over if you are looking for more options then you can have list containing Roman numbers, alphabets in the list instead of numbers (1,2,3…n). Ordered list have an attribute called type=”value”. |
|
And you know how to define the attribute of any element inside it. type attribute have different values. |
|
|
Format: |
<ol type=”value”> <li> item1 </li> <li> item2 </li> …….<li> itemn </li></ol> |
|
Attribute |
Value |
Description |
type
|
A
a
I
i
1
|
Specifies ordered list containing capital alphabets.
Specifies ordered list containing small alphabets.
Specifies ordered list containing big Roman alphabets.
Specifies ordered list containing Small Roman alphabets.
Specifies ordered list containing numbers.
|
|
|
|