HTML LI tag

Example

One ordered and one unordered HTML list:
<ol>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>
<ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>


Definition and Usage

The <li> tag defines a list item.
The <li> tag is used in both ordered (<ol>) and unordered (<ul>) lists.

Browser Support


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

Differences Between HTML and XHTML

The "type" and "value" attributes of the li element were deprecated in HTML 4.01, and are not supported in XHTML 1.0 Strict DTD.

Tips and Notes

Tip: Use CSS to define the type of list and list item.

Optional Attributes

DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

Attribute Value Description DTD
type 1
A
a
I
i
disc
square
circle
Deprecated. Use styles instead.
Specifies which kind of bullet point will be used
TF
value number Deprecated. Use styles instead.
Specifies the number of a list item
TF

Standard Attributes

id, class, title, style, dir, lang, xml:lang

Event Attributes

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
Share this article :
 
Copyright © 2012. Best Online Tutorials | Source codes | Programming Languages - All Rights Reserved