HTML List

There are three list types in HTML: unordered list — used to group a set of related items in no particular order. ordered list — used to group a set of related items in a specific order. description list — used to display name/value pairs such as terms and definitions.

Types of list

In Html there are three types of list.

  1. Ordered List (ol)
  2. Unordered List (ul)
  3. Description List (dl)

Ordered list

Used to display data in ordered form (in numbers 1,2,3,4.. so on).

Example

<!DOCTYPE html>
<html>

<head>
<title>HTML Ordered List</title>
</head>

<body>
<ol>
<li>Beetroot</li>
<li>Ginger</li>
<li>Potato</li>
<li>Radish</li>
</ol>
</body>

</html>

OUTPUT

1.Beetroot
2.Ginger
3.Potato
4.Radish

Unordered list

This type of list is used to display data in ordered form (in dots .).

Example

<!DOCTYPE html>
<html>

<head>
<title>HTML Unordered List</title>
</head>

<body>
<ul>
<li>Beetroot</li>
<li>Ginger</li>
<li>Potato</li>
<li>Radish</li>
</ul>
</body>

</html>

OUTPUT

  • Beetroot

  • Ginger

  • Potato

  • Radish

HTML Definition Lists

HTML and XHTML supports a list style which is called definition lists where entries are listed like in a dictionary or encyclopedia. The definition list is the ideal way to present a glossary, list of terms, or other name/value list.

Definition List makes use of following three tags.

<dl> − Defines the start of the list
<dt> − A term
<dd> − Term definition
</dl> − Defines the end of the list

Example

<!DOCTYPE html>
<html>

<head>
<title>HTML Definition List</title>
</head>

<body>
<dl>
<dt><b>HTML</b></dt>
<dd>This stands for Hyper Text Markup Language</dd>
<dt><b>HTTP</b></dt>
<dd>This stands for Hyper Text Transfer Protocol</dd>
</dl>
</body>

</html>

OUTPUT

HTML
This stands for Hyper Text Markup Language
HTTP
This stands for Hyper Text Transfer Protocol

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu