Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML <li> Tag


Example

One ordered (<ol>) and one unordered (<ul>) HTML list:

<ol>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>

<ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>
Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

The <li> tag defines a list item.

The <li> tag is used in ordered lists(<ol>), unordered lists (<ul>), and in menu lists (<menu>).


Browser Support

Element
<li> Yes Yes Yes Yes Yes

Tips and Notes

Tip: Use CSS to define the type of list and to style lists.


Attributes

Attribute Value Description
value number Specifies the value of a list item. The following list items will increment from that number (only for <ol> lists)

Global Attributes

The <li> tag also supports the Global Attributes in HTML.


Event Attributes

The <li> tag also supports the Event Attributes in HTML.



More Examples

Example

Set different list style types (with CSS):

<ol>
  <li>Coffee</li>
  <li style="list-style-type:lower-alpha">Tea</li>
  <li>Milk</li>
</ol>

<ul>
  <li>Coffee</li>
  <li style="list-style-type:square">Tea</li>
  <li>Milk</li>
</ul>
Try it Yourself »

In our CSS tutorial you can find more details about the list-style-type property.

Example

Create a list inside a list (a nested list):

<ul>
  <li>Coffee</li>
  <li>Tea
    <ul>
      <li>Black tea</li>
      <li>Green tea</li>
    </ul>
  </li>
  <li>Milk</li>
</ul>
Try it Yourself »

Example

Create a more complex nested list:

<ul>
  <li>Coffee</li>
  <li>Tea
    <ul>
      <li>Black tea</li>
      <li>Green tea
        <ul>
          <li>China</li>
          <li>Africa</li>
        </ul>
      </li>
    </ul>
  </li>
  <li>Milk</li>
</ul>
Try it Yourself »

Related Pages

HTML tutorial: HTML Lists

HTML DOM reference: Li Object

CSS Tutorial: Styling Lists


Default CSS Settings

Most browsers will display the <li> element with the following default values:

li {
  display: list-item;
}