An ordered list is a list of items where each item is marked with a number or letter. To create an ordered list, use the <ol>
element. Each item in the list is marked with the <li>
(list item) element.
Here’s an example:
<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
This will create an ordered list with three items, each marked with a number.
You can also change the numbering style using CSS. Here’s an example:
<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
<style>
ol {
list-style-type: upper-roman; /* change numbering style to upper roman numerals */
}
</style>
This will change the numbering style in the ordered list to upper roman numerals. There are many other types of list-style-type that you can use to change the numbering style. Some of the other values you can use include lower-alpha
, lower-roman
, decimal
, and none
.