HTML List:

A list is a record of short pieces of related information or used to display the data or any information on web pages in the ordered or unordered form. For instance, to purchase the items, we need to prepare a list that can either be ordered or unordered list which helps us to organize the data & easy to find the item.

Unordered HTML List:

<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>

List Item Marker:

The CSS list-style-type property is used to define the style of the list item marker. It can have one of the following values:

<ul>
<li>disc - Sets the list item marker to a bullet (default)</li>
<li>circle - Sets the list item marker to a circle</li>
<li>square - Sets the list item marker to a square</li>
<li>none - The list items will not be marked</li>
</ul>

Nested HTML Lists:


<ul>
<li>Coffee
<ul type="circle">
<li>Black tea
<ul type="square">
<li>Milk</li>
</ul>
</li>
</ul>
</li>
</ul>

Horizontal List with CSS:

<ul>
<li><a href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>

HTML Ordered List:

An ordered list starts with the <ol> tag. Each list item starts with the <li> tag. The list items are marked with numbers by default.

<ol>
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
</ol>

The Type Attribute:


The type attribute of the <ol> tag defines the type of the list item marker:

<ul>
<li>type="1" - The list items will be numbered with numbers (default)</li>
<li>type="A" - The list items will be numbered with uppercase letters</li>
<li>type="a" - The list items will be numbered with lowercase letters</li>
<li>type="I" - The list items will be numbered with uppercase roman numbers</li>
<li>type="i" - The list items will be numbered with lowercase roman numbers</li>
</ul>

Control List Counting:

By default, an ordered list will start counting from 1. If you want to start counting from a specified number, you can use the start attribute.

<ol start="5">
<li>Item1</li>
<li>Item2</li>
</ol>

HTML Description Lists:

HTML also supports description lists. A description list is a list of terms, with a description of each term. The <dl> tag defines the description list, the <dt> tag defines the term (name), and the <dd> tag describes each term.

<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
</dl>