Lists

HTML lists are used to display a group of items.

There are two main types of lists in HTML:

  • Unordered lists <ul>
  • Ordered lists <ol>

An unordered list is used when the items do not need to be in a particular order.

The items are usually displayed with bullet points.

<ul>
  <li>Apples</li>
  <li>Bananas</li>
  <li>Oranges</li>
</ul>

This will display:

  • Apples
  • Bananas
  • Oranges

<ul> – means unordered list. It tells the browser that the list does not have a specific order.

<li> – means list item. Each item in the list must be placed inside <li> tags.

An ordered list is used when the order of the items is important.

The items are usually displayed using numbers.

<ol> 
    <li>Turn on the computer</li> 
    <li>Open the web browser</li> 
    <li>Go to the website</li> 
</ol>

This will display:

  1. Turn on the computer
  2. Open the web browser
  3. Go to the website

<ol> means ordered list. It tells the browser that the items have a specific order.

<li> means list item. Each item is placed inside <li> tags.