There are 3 types of list in html:
-
- Ordered List
- A list where items are displayed in a specific order using numbers or letters.
-
- Unordered List
- A list where items are displayed with bullet points, without any order.
-
- Definition List
- A list used to define terms with their definition or details.
1. Ordered List Example:
Fruit List
- Apple
- Mango
- Banana
- Orange
- Grapes
Note: In HTML, we can change the numbering style of an Ordered List by using the type attribute, Example:
Types of numbering:
- type="1" → Default numbering (1, 2, 3, 4 …)
- type="A" → Uppercase letters (A, B, C, D …)
- type="a" → Lowercase letters (a, b, c, d …)
- type="I" → Uppercase Roman numbers (I, II, III, IV …)
- type="i" → Lowercase Roman numbers (i, ii, iii, iv …).
2. Unordered List Example:
Vegetable List
- Potato
- Tomato
- Carrot
- Onion
- Spinach
Note: In HTML, The type attribute changes the bullet style of the list items. It has 3 main values, Example:
- type="circle" → Hollow circle (○)
- type="square" → Solid square (■).
3. Definition List Example:
- HTML
- - HyperText Markup Language
- CSS
- - Cascading Style Sheets
- JavaScript
- - A programming language used to make web pages interactive
Note: We can make definition list with numbers by using definition list in order list or unorder list, Example:
-
- HTML
- HyperText Markup Language.
-
- CSS
- Cascading Style Sheets.
-
- JavaScript
- A programming language used to make web pages interactive.
Nested List:
You can put a second list inside an li element to create a sub list or nested list, Example:
- Five Vegetables Name:
- Potato
- Tomato
- Carrot
- Onion
- Spinach
-
Five Fruits Name:
- Apple
- Mango
- Banana
- Orange
- Grapes
Note:You can notice that ol can be used under ul and ul can be used under ol.
Go to top