HTML (Hypertext Markup Language) provides a way to create lists on a webpage. There are three types of lists in HTML: ordered lists, unordered lists, and definition lists.
- Ordered Lists
Ordered lists are used to present information in a specific order. They are created using the <ol> tag and each item in the list is enclosed in an <li> tag. The list items are numbered by default, but this can be changed using CSS.
Example:
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
- Unordered Lists
Unordered lists are used to present information in an unordered fashion. They are created using the <ul> tag and each item in the list is enclosed in an <li> tag. The list items are typically bulleted by default, but this can be changed using CSS.
Example:
<ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>
- Definition Lists
Definition lists are used to present a set of terms and their definitions. They are created using the <dl> tag, with each term enclosed in a <dt> tag and its definition enclosed in 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>
Lists can be nested within each other to create more complex structures. For example, an ordered list can contain an unordered list and vice versa.
