HTML <li> Tag

Topic: HTML5 Tags Reference« Prev|Next »

Description

The <li> (short for list item) defines an individual list item within a list. Each list item usually rendered with a bullet (in unordered lists, defined by the <ul> tag) or a number or letter (in the case of ordered lists, defined by the <ol> tag). The appearance of bullet or the number can be controlled with the type attribute.

The following table summarizes the usages context and the version history of this tag.

Parent: <ul>, <ol>, <dir>, <menu>
Placement: Block
Content: Block, inline, and text
Start/End Tag: Start tag: required, End tag: required
Version: HTML 2, 3.2, 4, 4.01, 5

Syntax

The basic syntax of the <li> tag is given with:

HTML / XHTML: <li> ... </li>

The example below shows the <li> tag in action.

  • <ul>
  •     <li>Item 1</li>
  •     <li>Item 2</li>
  •     <li>Item 3</li>
  • </ul>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <li> tag.

Attribute Value Description
type circle
disc
square
a
A
i
I
1
Obsolete Specify the bullet or numbering type for the list item.
value number Sets the number of the current list item (only for ordered lists).

Global Attributes

Like all other HTML tags, the <li> tag supports the global attributes in HTML5.


Event Attributes

The <li> tag also supports the event attributes in HTML5.


Browser Compatibility

The <li> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 2+
  • Apple Safari 1+
  • Opera 4+

Further Reading

See tutorial on: HTML Lists.

Related tags: <ul>, <ol>.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.