HTML <ol> type Attribute❮ HTML <ol> tag Show
ExampleAn ordered list with uppercase roman numbers:
<ol type="I">
Try it Yourself »
More "Try it Yourself" examples below. HTML Ordered Lists
❮ Previous
Next ❯
The HTML <ol> tag defines an ordered list. An ordered list can be numerical or alphabetical. <ol>: The Ordered List elementThe <ol> HTML element represents an ordered list of items — typically rendered as a numbered list.
The default – normal Arabic numbersHere’s an example of a default ordered list:
And the HTML behind it: <ol>
<li>Apples</li>
<li>Bananas</li>
<li>Oranges</li>
</ol>
Ordered List Type AttributeWhile on the webinar, I said, "Hmm, I'm not sure, but let's google it" and we wound up on the W3Schools.com HTML <ol> type Attributepage. And it turns out, yes, there are different options instead of just numbers. All we need to do is add the type attribute on our <ol> tag and say what we want. As shown above, if we don't add a type attribute, the default is just decimal numbers. Let's look at two other options. AlphabeticalWe can display our list using letters by using <ol type="A">. For example: <ol type="A"> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ol>You can also display this using lowercase letters with <ol type="a">: <ol type="a"> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ol>What If I Have a Lot Of Items?If you have a list that has more than 26 items in it, you probably aren't going to be using an alphabetical list type. But I was curious, what would happen if I had 27 items in my list? Would it just start over again? What happens is that it then begins to display two letters, starting with AA, then AB, AC, AD, etc... HTML Ordered List | HTML Numbered ListHTML Ordered List or Numbered List displays elements in numbered format. The HTML ol tag is used for ordered list. We can use ordered list to represent items either in numerical order format or alphabetical order format, or any format where an order is emphasized. There can be different types of numbered list:
To represent different ordered lists, there are 5 types of attributes in <ol> tag.
Create an ordered list with capital letters and starting at point 4 in HTML and CSSDescriptionThe following code shows how to create an ordered list with capital letters and starting at point 4. Example
<!-- w w w .j a v a 2s .c om-->
<html>
<body>
<p>Here is an ordered list using capital letters and starting at point 4, which is a letter D:</p>
<ol type="A" start="4">
<li>Point number one</li>
<li>Point number two</li>
<li>Point number three</li>
</ol>
</body>
</html>
Click to view the demo The code above generates the following result. Next» «Previous |