HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<li> (List Item)


This element is used to indicate a list item as contained in an ordered list (<ol>), unordered list (<ul>), or older list styles such as <dir> and <menu>.

Standard Syntax


<li
class="class name(s)"
dir="ltr | rtl"
id="unique alphanumeric identifier"
lang="language code"
style="style information"
title="advisory text"
type="circle | disc | square | a | A | i | I | 1"
value="number" (value attribute transitional only)
/li>

Attributes Defined by Internet Explorer


accesskey="key" (5.5)
contenteditable=" false | true | inherit" (5.5)
disabled="false | true" (5.5)
hidefocus="true | false" (5.5)
language="javascript | jscript | vbs | vbscript" (4)
tabindex="number" (5.5)
unselectable="on | off" (5.5)

Standard Event Attributes


onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup

Events Defined by Internet Explorer


onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlayoutcomplete, onlosecapture, onmouseenter, onmouseleave, onmouseup, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onselectstart, ontimeerror

Element Specific Attributes


type
This attribute indicates the bullet type used in unordered lists or the numbering type used in ordered lists. For ordered lists, a value of a indicates lowercase letters, A indicates uppercase letters, i indicates lowercase Roman numerals, I indicates uppercase Roman numerals, and b indicates numbers. For unordered lists, values are used to specify bullet types. Although the browser is free to set bullet styles, a value of disc generally specifies a filled circle, a value of circle specifies an empty circle, and a value of square specifies a filled square. Browsers such as WebTV might include other bullet shapes like triangles.

value
This attribute indicates the current number of items in an ordered list as defined by the <ol> element. Regardless of the value of type being used to set Roman numerals or letters, the only allowed value for this attribute is a number. List items that follow will continue numbering from the value set. The value attribute has no meaning for unordered lists.

Examples


<ul>
  <li type="circle">First list item is a circle
  <li type="square">Second list item is a square
  <li type="disc">Third list item is a square
</ul>

<ol>
  <li type="i">Roman Numerals
  <li type="a" value="3">Second list item is letter C
  <li type="a">Continue list in lowercase letters
</ol>

XHTML Example


<ul>
  <li>First list item</li>
  <li>Second list item</li>
  <li>Third list item</li>
</ul>

Compatibility


HTML 2, 3.2, 4, 4.01, XHTML 1.0, 1.1, Basic
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4- 4.7, 6
Opera 4-7

Notes


Under the strict HTML and XHTML definitions, the <li> element loses the type and value attributes, as these functions can be performed with style sheets.

Whereas bullet styles can be set explicitly, browsers tend to change styles for bullets when <ul> lists are nested. However, ordered lists generally do not change style automatically, nor do they support outline style number (1.1, 1.1.1, and so on).

The closing tag </li> is optional under HTML specifications and is not commonly used.

(X)HTML Elements
CSS Properties
Previous: legend Next: link
< Home | About | Chapters | Examples | Errata | Reference | Site Map >