HTML Lists

Lists in HTML are used to list information. Web developers can use HTML lists to group items that go together. All lists may contain one or more list elements.

There are three kinds of lists in HTML:

  • Ordered List or Numbered List (ol)
  • Unordered List or Bulleted List (ul)
  • List of explanations or explanations (dl)

HTML Ordered List or Numbered List

By default, all of the list items in ordered HTML lists are marked with a number. It is also called a number list. The <ol> tag starts the list in order, and the <li> tag starts the list items.

Example

<ol>
<li>Red</li>
<li>Blue</li>
<li>Green</li>
<li>Orange</li>
</ol>

Output

  1. Red
  2. Blue
  3. Green
  4. Orange

HTML Unordered List or Bulleted List

All of the list items in an HTML Unordered list are marked with bullets. It can also be called a bulleted list. The <ul> tag starts an unordered list, and the <li> tag starts a list item.

Example

<ul>
<li>Red</li>
<li>Blue</li>
<li>Green</li>
<li>Orange</li>
</ul>

Output

  • Red
  • Blue
  • Green
  • Orange

HTML List of Definitions or List of Descriptions

HTML Description list is another style of list that both HTML and XHTML can handle. It\’s also called a \”definition list\” because it has entries like a dictionary or encyclopaedia.

When you want to show a glossary, list of terms, or other name-value list, the definition list is a good choice.

The following three tags are on the list of HTML definitions:

  • <dl> tag shows where the list starts.
  • <dt> tag defines a term.
  • <dd> tag explains what the term means (description).

Example

<!DOCTYPE html>
<html>
<body>

<h2>A Description List</h2>

<dl>
<dt>Red</dt>
<dd>-Blood color is red.</dd>
<dt>Blue</dt>
<dd>-Sky color is blue</dd>
<dt>Green</dt>
<dd>-Tree color is Green.</dd>
<dt>Orange</dt>
<dd>-Orange color is orange.</dd>
</dl>

</body>
</html>

Output

\"discription

 

HTML Nested List

A nested list is a list that is inside of another list. If you want a list with bullet points inside a list with numbers, this is called a \”nested list.\”

Example

<!DOCTYPE html>
<html>
<head>
<title>Example of Nested list</title>
</head>
<body>
<h2> Indian State names with thier capital</h2>
<ol>
<li>Delhi
<ul>
<li>NewDelhi</li>
</ul>
</li>
<li>Gujarat
<ul>
<li>Gandhinagar</li>
</ul>
</li>
<li>Kashmir
<ul>
<li>Srinagar</li>
</ul>
</li>
<li>Maharashtra
<ul>
<li>Mumbai</li>
</ul>
</li>
<li>Punjab
<ul>
<li>Chandigarh</li>
</ul>
</li>

<li>Rajasthan
<ul>
<li>Jaipur</li>
</ul>
</li>

<li>Uttarpradesh
<ul>
<li>Lucknow</li></ul>
</li>

</ol>
</body>
</html>

Output

  1. Delhi
    • NewDelhi
  2. Gujarat
    • Gandhinagar
  3. Kashmir
    • Srinagar
  4. Maharashtra
    • Mumbai
  5. Punjab
    • Chandigarh
  6. Rajasthan
    • Jaipur
  7. Uttarpradesh
    • Lucknow

HTML List Tags

Tag Description
<ul> An unordered list
<ol> An ordered list
<li> A list item
<dl> A description list
<dt> A term in a description list
<dd> The term in a description list
Related Posts
Introduction to HTML

HTML Introduction HTML is the most common language used to mark up Web pages. What does HTML mean? Hyper Text Read more

What is HTML

HTML stands for Hyper Text Markup Language, which is a programming language used to make web pages and web apps. Read more

HTML Basic Examples

In this chapter, we\'ll show you some simple examples of HTML code. Don\'t worry if we use tags that you Read more

HTML text Editors

Editors for HTML text HTML files are text files, so any text editor can be used to make them. Text Read more

HTML Tags

Learn HTML Tags HTML tags are kind of like keywords that tell a web browser how to format and show Read more

HTML Elements

Elements make up an HTML file. These elements are what make web pages and tell you what content is on Read more

HTML Attributes

Attribute in HTML Attributes in HTML are special words that tell you more about an element. Attributes change the way Read more

HTML Headings

Headings in HTML The <h1> to <h6> tags are used to set up headings in HTML. <h1> shows which heading Read more

Scroll to Top