HTML lists are used to present a list of items or information in a structured manner. There are three primary types of lists in HTML:
Ordered List (Numbered List)
Unordered List (Bulleted List)
Description List (Definition List)
An ordered list is used when the sequence of the list items is important. By default, items in an ordered list are numbered.
<!DOCTYPE html>
<html>
<head>
<title>Ordered List Example</title>
</head>
<body>
<h2>My Favorite Fruits</h2>
<ol>
<li>Apple</li>
<li>Banana</li>
<li>Cherry</li>
</ol>
</body>
</html>
An unordered list is used when the order of the list items is not important. By default, items in an unordered list are marked with bullets.
<!DOCTYPE html>
<html>
<head>
<title>Unordered List Example</title>
</head>
<body>
<h2>Types of Pets</h2>
<ul>
<li>Dog</li>
<li>Cat</li>
<li>Bird</li>
</ul>
</body>
</html>
A description list is used to define terms and their descriptions. It consists of a list of terms with their corresponding descriptions.
<!DOCTYPE html>
<html>
<head>
<title>Description List Example</title>
</head>
<body>
<h2>Glossary</h2>
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language, the standard language for creating web pages.</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets, a language used to style HTML elements.</dd>
<dt>JavaScript</dt>
<dd>A programming language used to create interactive effects within web browsers.</dd>
</dl>
</body>
</html>