HTML Encyclopaedia

The li tag

The HTML element
<li> text </li>
Introduces an element or item in an un-numbered or numbered list. The text after the tag is taken as part of the list element until either another <li> tag is encountered or another start of list or end of list tag is encountered.

The appearance of an <li> tag implies the end of any previous list item so there is no need for the </li> and it is rarely seen in practice. (cf <p> ... </p>)

The <li> tag takes two attributes.

  1. type

    This is only useful within an <ul> list. It enables a particular list element to be presented with a specific bullet style. Here's an example.

    The item Yellow should be presented with a square bullet. This doesn't work properly, Microsoft Internet Explorer 3 ignores the type attribute altogether and Netscape 3.0 forgets to revert back to circle bullets after the first square bullet.

  2. value

    This is only useful within an <ol> list. It enables the list numbering to be set to a specific value, incremental numbering continues from the new value. Here's an example

    1. Red
    2. Yellow
    3. Green
    4. Blue

    The list items should be numbered 1,5,6,7

Browsers
The handling of the type attribute is erratic. ARA, NN3 rendered a square bullet for the item Yellow but then failed to revert to circle bullets. IE3, MOS3 totally ignore the type attribute. MOS3 also ignored the value attribute. OP2 handled both attributes correctly.


See also <ol>, <ul>, <dl> and the general information about lists.