There are three types of lists present in an HTML document namely unordered list, ordered list and description list.
Unordered HTML list
It is defined using <ul> tag where each list item is enclosed between <li> tag.
Syntax
Following is the syntax −
<ul> <li>List Item</li> <li>List Item</li> <li>List Item</li> <ul>
Ordered HTML list
It is defined using <ol> tag where each list item is enclosed between <li> tag.
Syntax
Following is the syntax −
<ol> <li>List Item</li> <li>List Item</li> <li>List Item</li> <ol>
Description HTML list
It is defined by using <dl> tag where each define term is enclosed between <dt> tag and each description is enclosed between <dd> tag.
Syntax
Following is the syntax −
<dl> <dt>define term</dt> <dd>describe term</dd> <dt>define term</dt> <dd>describe term</dd> <dl>
Let us see an example of HTML Lists:
Example
<!DOCTYPE html>
<html>
<style>
body {
color: #000;
height: 100vh;
background-color: #8BC6EC;
background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%);
}
</style>
<body>
<h1>HTML Lists Demo</h1>
<h3>Unordered List</h3>
<ul>
<li>Physics Subject</li>
<li>Chemistry Subject</li>
<li>Economics Subject</li>
</ul>
<h3>Ordered List</h3>
<ul>
<li>Physics Book Part 1</li>
<li>Physics Book Part 2</li>
<li>Physics Book Part 3</li>
</ul>
<h3>Description List</h3>
<dl>
<dt>Physics Book</dt>
<dd>- It covers modern physics and quantum physics</dd>
<dt>Chemistry Book</dt>
<dd>- It covers organic, inorganic and physical chemistry</dd>
</dl>
</body>
</html>Output
