In HTML, there are three types of lists: ordered lists, unordered lists, and definition lists.
- Ordered Lists (
<ol>
)
An ordered list is a list of items where each item is numbered. To create an ordered list, use the <ol>
element. Each item in the list is marked with the <li>
(list item) element.
Here’s an example:
<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
This will create an ordered list with three items, each numbered sequentially.
- Unordered Lists (
<ul>
)
An unordered list is a list of items where each item is marked with a bullet point or other symbol. To create an unordered list, use the <ul>
element. Each item in the list is marked with the <li>
(list item) element.
Here’s an example:
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
This will create an unordered list with three items, each marked with a bullet point.
- Definition Lists (
<dl>
)
In HTML, a definition list is a collection of terms and their corresponding definitions presented in a structured format. To create a definition list in HTML, you can use the <dl>
element.. Each term in the list is marked with the <dt>
(definition term) element, and each definition is marked with the <dd>
(definition description) element.
Here’s an 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>
This code will generate a definition list consisting of three terms and their corresponding definitions.