HTML 5 li tag

From http://www.w3schools.com (Copyright Refsnes Data)

# HTML 5 <li> tag

## Definition and Usage

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

## Differences Between HTML 4.01 and HTML 5

The "type" and "value" attributes were deprecated in HTML 4.01.

The "type" attribute is no longer supported in HTML5

The "value" attribute is no longer deprecated in HMTL 5, but can only be used with the <ol> element

## Tips and Notes

Tip: Use CSS to define the type of list.

## Examples

Source | Output
--- | ---

<ol>
<li>Coffee</li>
<li>Tea</li>
</ol>

<ol>
<li value="7">Coffee</li>
<li>Tea</li>
</ol>

<ul>
<li>Coffee</li>
<li>Tea</li>
</ul>

1. Coffee
2. Tea

1. Coffee
2. Tea

- Coffee
- Tea

## Attributes

- 4: indicates if the attribute is defined in HTML 4.01
- 5: indicates if the attribute is defined in HTML 5

Attribute | Value | Description | 4 | 5
--- | --- | --- | --- | ---

type

A
a
I
i
1
disc
square
circle

Specifies the type of the list. Not supported. Use CSS instead

4

value | number_of_list_item | Defines the value of the first list item. No longer deprecated. |  | 5

## Standard Attributes

class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title

For a full description, go to Standard Attributes in HTML 5.

## Event Attributes

onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload

For a full description, go to Event Attributes in HTML 5.

## Try-It-Yourself Demos

An unordered list
An unordered list.

An ordered list
An ordered list.

A nested list
A nested list.

Another nested list
A more complicated nested list.

From http://www.w3schools.com (Copyright Refsnes Data)