Code has been added to clipboard!

HTML li Tag

Reading time 2 min
Published Jun 29, 2017
Updated Oct 2, 2019

HTML li: Main Tips

  • You can use HTML li tags as descendants of <ol>, <ul>, or <menu> elements to define a single item in a list.
  • Both starting and ending tags are mandatory.
  • You can style HTML li elements using CSS.

Using li in HTML

HTML <li> tag defines a list item within a list:

Example
<p>This list is unordered:</p>
<ul>
  <li>Cacao</li>
  <li>Water</li>
  <li>Juice</li>
</ul>

<p>This list is ordered:</p>
<ol>
  <li>Cacao</li>
  <li>Water</li>
  <li>Juice</li>
</ol>

Note: you have to place HTML li tags in a parent element: <ol>, <ul>, or <menu>.

In most browsers, <li> element will be displayed with these default values:

Example
li {
    display: list-item;
}

Using HTML <li> tags, you can also create lists within lists (nested lists):

Example
<ul>
  <li>Cacao</li>
  <li>Water
    <ul>
      <li>Clean water</li>
      <li>Tap water</li>
    </ul>
  </li>
  <li>Juice</li>
</ul>

Attributes for <li>

value defines the ordinal value of a list item:

Example
<ol>
  <li value="100">Cacao</li>
  <li>Water</li>
  <li>Juice</li>
  <li>Beer</li>
  <li>Cola</li>
</ol>

value can only be used with numbered lists and defined in a number. It was deprecated in HTML4, but then brought back in HTML5.

The currently deprecated type attribute defined the kind of bullet point to use:

Example
<ol>
  <li>Cacao</li>
  <li type="a">Water</li>
  <li>Juice</li>
</ol>

<ul>
  <li>Cacao</li>
  <li type="square">Water</li>
  <li>Juice</li>
</ul>

Note: instead of type, use CSS list-style-type property.

Browser support

Chrome
All
Edge
All
Firefox
1+
IE
All
Opera
All
Safari
All

Mobile browser support

Chrome
All
Firefox
4+
Opera
All
Safari
All
Basics
Introduction
Syntax
Editors
Basic Examples
Head Section
<!DOCTYPE>
Tags and Elements
Semantic Elements
Tags Reference
Attributes
Comments
Block and Inline Elements
Forms
Form Elements
Input
Responsive Web Design
Inline Scripts
Uniform Resource Locator
Redirect
XHTML
Geolocation
Drag and Drop
Local Storage
Web Workers
Server-Sent Events
Character Encoding
Text Formatting
Quotation and Citation Elements
Headings
Paragraphs
Links
Tables
Lists
Symbols
Space
Tab
Styles
Computer Code
Layout
Classes
Colors
Images
iframes
Audio Player
Video Player
YouTube Videos
Multimedia
Canvas
SVG
<!-- -->
<a>
<abbr>
<acronym> DEPRECATED
<address>
<applet> DEPRECATED
<article>
<aside>
<audio>
<b>
<base>
<basefont> DEPRECATED
<bdi>
<bdo>
<big> DEPRECATED
<blink> DEPRECATED
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<center> DEPRECATED
<cite>
<code>
<col>
<colgroup>
<datalist>
<dd>
<del>
<details>
<dfn>
<dialog>
<dir> DEPRECATED
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<font> DEPRECATED
<footer>
<form>
<frame> DEPRECATED
<frameset> DEPRECATED
<h1> – <h6>
<head>
<header>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<keygen> DEPRECATED
<label>
<legend>
<li>
<link>
<main>
<map>
<mark>
<menu>
<menuitem> DEPRECATED
<meta>
<meter>
<nav>
<noframes> DEPRECATED
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike> DEPRECATED
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt> DEPRECATED
<u>
<ul>
<var>
<video>
<wbr>