HTML Lists

There are two types of list in html they are ordered list and unordered list. 

unordered list start with <ul> tag and end with </ul> tag. In between this tag we need to add <li> and </li> tag to add the list.

Ordered list start with <ol> and </ol> between this <li> and </li> tag is used to add the list

An unordered HTML list:

  • Item

  • Item

  • Item

  • Item

An ordered HTML list:

  1. First item

  2. Second item

  3. Third item

  4. Fourth item

Example:

unordered list

<ul>
<li>Cat</li>
<li>Dog</li>
<li>Cow</li>
</ul>

Example:

ordered list

<ol>
<li>cat</li>
<li>Dog</li>
<li>Cow</li>
</ol>

​Output:

  • Cat

  • Dog

  • Cow

Output:

  1. Cat

  2. Dog

  3. Cow

Description Lists

The <dl> tag defines the description list, the <dt> tag defines the term , and the <dd> tag describes each term:

Example:

Description Lists

<dl>
  <dt>Cat</dt>
  <dd>pet</dd>
  <dt>Lion</dt>
  <dd>wild animal</dd>
</dl>

Output:

Cat

            pet

Lion

            wild animal