HTML » Tags » li

Version: 2.0, 3.2, 4.0

Compability: Explorer 4, 5  Netscape 4, 6

Syntax:
<li> ... </li>

The <li> tag is used to list an item in a list. This tag is required for both the ordered list ol tag and the unordered list ul tag. (It is also required for two deprecated tags, the dir directory list and the menu list.)

For ordered and unordered lists, there are essentially no restrictions as to the text that may be placed in a list, such as length. (However, directory and menu lists, by definition, are listings of short items.)
 
In an unordered list, each item is preceded by a bullet, such as •. In an ordered list, each item is labeled with a number, letter, or Roman numeral that increments with each following item.
 
The ending tag is optional. However, it is recommended that it be included.
 

Examples

Code:
Three Major Types Of Lists:
<ul>
<li> Definition List
<ul type="square">
<li> dd tag
<li> dl tag
<li> dt tag
</ul>
<li> Ordered List
<ul type="circle">
<li> ol tag
<li> li tag
</ul>
<li> Unordered List
<ul type="disc">
<li> ul tag
<li> li tag
</ul>
</ul>
Output:
Three Major Types Of Lists:
  • Definition List
    • dd tag
    • dl tag
    • dt tag
  • Ordered List
    • ol tag
    • li tag
  • Unordered List
    • ul tag
    • li tag
Explanation:

This example displays an unordered list.

Language(s): HTML
Code:
Three Major Types Of Lists:
<ol>
<li> Definition List
<ol type="A" start="5">
<li> dd tag
<li> dl tag
<li> dt tag
</ol>
<li> Ordered List
<ol type="i">
<li> ol tag
<li> li tag
</ol>
<li> Unordered List
<ol type="1">
<li> ul tag
<li> li tag
</ol>
</ol>
Output:
Three Major Types Of Lists:
  1. Definition List
    1. dd tag
    2. dl tag
    3. dt tag
  2. Ordered List
    1. ol tag
    2. li tag
  3. Unordered List
    1. ul tag
    2. li tag
Explanation:

This example displays an ordered list.

Language(s): HTML

See Also: