How to use letters and roman numerals instead of numbers in an HTML ordered list
Posted October 3rd, 2009 in HTML and CSS
HTML ordered lists <ol> use normal numbers by default but it's also possible to use lower or upper case letters (i.e. a b c and A B C) and roman numbers in upper or lower case (i.e. i ii iii and I I III) by using the "type" attribute.
The default - normal Arabic numbers
Here's an example of a default ordered list:
- Apples
- Bananas
- Oranges
And the HTML behind it:
<ol>
<li>Apples</li>
<li>Bananas</li>
<li>Oranges</li>
</ol>
Lower and upper case letters
To make the ordered list show letters instead of numbers, specify type="A" for uppercase and type="a" for lowercase letters in the <ol> element. Here's an example of an ordered list using uppercase letters:
- Apples
- Bananas
- Oranges
And the HTML behind it:
<ol type="A">
<li>Apples</li>
<li>Bananas</li>
<li>Oranges</li>
</ol>
Lower and upper case Roman numbers
To use Roman numbers instead, specify type="I" for uppercase Roman numbers (e.g. I II III IV V etc) and type="i" for lowercase Roman numbers (e.g. i ii iii iv v). Here's an example of an ordered list using lowercase Roman numbers:
- Apples
- Bananas
- Oranges
And the HTML behind it:
<ol type="i">
<li>Apples</li>
<li>Bananas</li>
<li>Oranges</li>
</ol>
Combining them together
Let's say you want to have a table of contents with numbers for the main items and then lower case letters for the subitems. Here's an example:
- Fruit
- Apples
- Bananas
- Oranges
- Vegetables
- Carrots
- Lettuce
- Cucumbers
And the HTML behind it:
<ol>
<li>Fruit
<ol type="a">
<li>Apples</li>
<li>Bananas</li>
<li>Oranges</li>
</ol>
</li>
<li>Vegetables
<ol type="a">
<li>Carrots</li>
<li>Lettuce</li>
<li>Cucumbers</li>
</ol>
</li>
</ol>
Starting with a number other than 1
My next HTML post looks at how to start an HTML ordered list with a number other than 1.
Related posts:
- Aligning HTML bullet points against the margin (Tuesday, May 4th 2010)
- Starting an HTML ordered list with a number other than 1 (Saturday, October 10th 2009)
- Prevent dotted border from appearing when clicking links in Firefox (Saturday, September 12th 2009)
- CSS cursor property (Saturday, September 5th 2009)
- How to do a strikethrough with CSS (Saturday, June 13th 2009)
- Blockquotes and XHTML Strict (Saturday, April 11th 2009)
Share or Bookmark
Share or Bookmark this page using the following services. You will need to have an account with the selected service in order to post links or bookmark this page.
Subscribe or Follow
Subscribe via RSS or email, or follow me on Facebook or Twitter below. The RSS icon takes you through to Feedburner where you can select the service or application to use.

