HTML Lists
Unordered HTML List
An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.
The list items will be marked with bullets (small black circles) by default:
Ordered HTML List
An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.
The list items will be marked with numbers by default:
Example
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<!DOCTYPE html> <html> <body> <h3>An Unordered HTML List</h3> <ul> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul> <h3>An Ordered HTML List</h3> <ol> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ol> </body> </html> |
Result
An Unordered HTML List
- Coffee
- Tea
- Milk
An Ordered HTML List
- Coffee
- Tea
- Milk
HTML <li> Tag
Definition and Usage
The <li> tag defines a list item.
The <li> tag is used inside ordered lists(<ol>), unordered lists (<ul>), and in menu lists (<menu>).
In <ul> and <menu>, the list items will usually be displayed with bullet points.
In <ol>, the list items will usually be displayed with numbers or letters.
HTML <dl> Tag
A description list, with terms and descriptions:
Example
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<!DOCTYPE html> <html> <body> <h3>The dl, dd, and dt elements</h3> <p>These three elements are used to create a description list:</p> <dl> <dt>Coffee</dt> <dd>Black hot drink</dd> <dt>Milk</dt> <dd>White cold drink</dd> </dl> </body> </html> |
Result
The dl, dd, and dt elements
These three elements are used to create a description list:
- Coffee
- Black hot drink
- Milk
- White cold drink