li (HTML element)

Spec
Depr. Empty Version
No No HTML 2
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

<li>
</li>

Description

The li element defines an individual list item and can only appear inside the handful of list-related elements detailed above. Each list item is represented by a bullet (for unordered lists, defined by the ul element) or a number or letter (in the case of ordered lists, defined by the ol element).

The example above shows the li as it’s used in an ordered list (ol), but it could be applied identically inside an unordered list (ul):

<ul>
  <li>Eggs</li>
  <li>Cheese</li>
  <li>Milk</li>
  <li>Papadums</li>
  <li>Tickle-me Elmo</li>
  <li>Dr Who Remote Control Dalek</li>
</ul>

The two types of list items would render as shown in Figure 1.

Figure 1. An ordered list followed by an unordered list An ordered list followed by an unordered list

List items may also appear inside dir and menu elements, although it should be noted that both dir and menu are now deprecated and should no longer be used.

Example

Here’s the li element in action, being used within a ol element:

<ol>
  <li>Remove the outer casing by pushing the plastic rivets
    through.</li>
  <li>Disconnect the main power harness from the inner unit
    (unclip).</li>
  <li>Remove connection to the glow plug.</li>
  <li>Extract unit, keeping upright at all times.</li>
</ol>

Use This For …

A list item will usually—but not always—contain text, along with some formatting (phrase) elements. However, an li can contain block-level elements, typically divs, nested ul or ol elements, and p elements.

Note that if the li element is contained inside either of the (now deprecated) dir or menu elements, it cannot contain block-level elements.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full

Every browser listed supports this element type.

In this Section

User-contributed notes

There are no comments yet.

Related Products