HTML provides several tags for creating lists on a web page. Here are some of the most commonly used list tags in HTML:
Unordered list: <ul>
The <ul>
tag is used to create an unordered list, which displays a bullet point for each item in the list. Each list item is enclosed within <li>
tags.
Example:
<ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul>
Ordered list: <ol>
The <ol>
tag is used to create an ordered list, which displays a numbered or lettered list. Each list item is enclosed within <li>
tags.
Example:
<ol> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ol>
Definition list: <dl>
The <dl>
tag is used to create a definition list, which displays a list of terms and their corresponding definitions. Each term is enclosed within a <dt>
tag, and each definition is enclosed within a <dd>
tag.
Example:
<dl> <dt>Term 1</dt> <dd>Definition 1</dd> <dt>Term 2</dt> <dd>Definition 2</dd> <dt>Term 3</dt> <dd>Definition 3</dd> </dl>
Nested lists:
You can also nest lists inside other lists by placing a list inside a list item.
For example:
<ul> <li>Item 1</li> <li>Item 2 <ul> <li>Sub-item 1</li> <li>Sub-item 2</li> </ul> </li> <li>Item 3</li> </ul>
This creates an unordered list with three items, where the second item contains a nested unordered list with two sub-items.
These are some of the most commonly used list tags in HTML. They allow you to organize and present information in a clear and structured way on your web pages.