Table of Contents
HTML List Tag
HTML offers three ways for specifying lists: ordered lists, unordered lists, and description lists. Ordered lists use ordinal sequences to indicate the order of list elements, unordered lists use a defined symbol such as a bullet to list elements in no designated order, and description lists use indents to list elements with their children. This topic explains the implementation and combination of these lists in HTML markup.
Ordered List
An ordered list can be created with the <ol> tag and each list item can be created with the <li> tag as in the example below:
This will produce a numbered list (which is the default style):
Manually changing the numbers
There are a couple of ways you can play with which numbers appear on the list items in an ordered list. The first way is to set a starting number, using the start attribute. The list will start at this defined number, and continue incrementing by one as usual.
This will produce a numbered list (which is the default style):
You can also explicitly set a certain list item to a specific number. Further list items after one with a specified value will continue incrementing by one from that list item’s value, ignoring where the parent list was at.
<li value=”7″></li>
It is also worth noting that, by using the value attribute directly on a list item, you can override an ordered list’s existing numbering system by restarting the numbering at a lower value. So if the parent list was already up to value 7, and encountered a list item at value 4, then that list item would still display as 4 and continue counting from that point again.
So the example above will produce a list that follows :
Note: The start and value attributes only accept a number – even if the ordered list is set to display as Roman numerals or letters.
You can reverse the numbering by adding reversed in your ol element:
Output :
Reverse numbering is helpful if you’re continually adding to a list, such as with new podcast episodes or presentations, and you want the most recent items to appear first.
Changing the type of numeral
You can easily change the type of numeral shown in the list item marker by using the type attribute :
<ol type=”1|a|A|i|I”>
Type | Description | Examples |
1 | Default value – Decimal numbers | 1, 2, 3, 4, 5 |
a | Alphabetically ordered (lowercase) | a, b, c, d, e |
A | Alphabetically ordered (uppercase) | A,B,C,D, E |
i | Roman Numerals (lowercase) | i, ii, iii, iv, v |
I | Roman Numerals (uppercase) | I, II, III, IV, V |
You should use ol to display a list of items, where the items have been intentionally ordered and order should be emphasized. If changing the order of the items does NOT make the list incorrect, you should use <ul>.
Unordered List
An unordered list can be created with the <ul> tag and each list item can be created with the <li> tag as shown by the example below:
This will produce a bulleted list (which is the default style):
You should use ul to display a list of items, where the order of the items is not important. If changing the order of the items makes the list incorrect, you should use <ol>.
Nested lists
You can nest lists to represent sub-items of a list item.
Output :
The nested list has to be a child of the li element.
Common list-style-type values for unordered lists:
disc: This is the default style, displaying a filled circular bullet.
circle: Displays an empty circular bullet.
square: Displays a solid square bullet.
none: Removes the bullet point entirely.
Example :
Output :
Description List
A description list (or definition list, as it was called before HTML5) can be created with the dl element. It consists of name-value groups, where the name is given in the dt element, and the value is given in the dd element.
Example :
Output :
You May Like to Browers More


