HTML List

In HTML, a list is a way to display a group of related items in an ordered or unordered format.

Lists are commonly used to create menus, navigation bars, and other types of content where a group of related items need to be presented in a structured way.

HTML provides three types of lists

  1. Ordered List
  2. Unordered List
  3. Definition List

Lets see each list one by one with suitable example.

Ordered List

An ordered list is a list where the items are numbered or lettered.

The order of the items is important, and they are displayed in the order in which they are written in the HTML code. The syntax for creating an ordered list is:

Syntax

We can use type attribute to show list number type.

  1. <ol type=”1″ value=”1″> list start with number 1 and its type is numberic
  2. <ol type=”1″ value=”5″> list start with number 5 and its type is numberic
  3. <ol type=”A”>  list start with capital letter A
  4. <ol type=”A” value=”3″>  list start with capital letter C
  5. <ol type=”a”> list will start with small letter a
  6. <ol type=”I”> list will start with capital roman letter
  7. <ol type=”i”> list will start with small roman letter

Example:

Unordered List


An unordered list is a list where the items are marked with bullets or other symbols. The order of the items is not important, and they are displayed in the order in which they are written in the HTML code. The syntax for creating an unordered list is:

You can use type attributes for showing different list market types.
like <li type=”disc”>, <li type=”circle”> or <li type=”square”>

Example:

Definition List


A definition list is a list where each item consists of a term and a definition.

The term is usually displayed in the bold or emphasized text, and the definition is displayed after it. The syntax for creating a definition list is:

Example of Definition list is

We can also use a nested list means list inside another list of any kind.