li ... ⁄li
HTML5 li element
The li element allows you to add items to any of the next 3 elements: ol, ul, menu (if type="toolbar"). »video
About li
- is an optional element
- multiple li elements allowed per HTML5 document within the ol, ul or a toolbar menu element
Display & support li
- display in browser »video





Parents, children li
- li nested within elements »li parents
- elements nested within li »li children
»examples
»video
Attributes li
- required: none
- optional: specific attributes, global attributes, event attributes
Observation: value attribute can be applied only to li elements children of an ol element. »video
Syntax li
1 2 | <> ... </> <> ... »video |
Attributes and Values li (comma separated)
< | attribute | = | "attribute_value(s)" | > | Video | Examples |
---|---|---|---|---|---|---|
1. specific attributes | ||||||
1. | value | = | integer | »video | <value="4"> | |
All Specific Attributes | ||||||
2. global attributes | ||||||
1. | accesskey | = | keyboard key | »img | <accesskey="h"> ... </ > | |
2. | class | = | class name | »html »img | <class="class_name"> ... </ > | |
3. | contenteditable | = | "", , true, false | »html | <contenteditable="true"> ... </ > | |
4. | contextmenu | = | menu id value | »html | <contextmenu="menu_id_value"> ... </ > | |
5. | data-* | = | value | - | <data-http-error="404"> ... </ > | |
6. | dir | = | ltr, rtl, auto | »html | <dir="ltr"> ... </ > | |
7. | draggable | = | true, , false | »img | <draggable="false"> ... </ > | |
8. | dropzone | = | copy, move, link, string:, file: | - | <dropzone="copy"> ... </ > | |
9. | hidden | = | "", , hidden | »html »img | <hidden="hidden"> ... </ > | |
10. | id | = | id name | »html »img | <id="unique_id_name"> ... </ > | |
11. | itemid | = | URL | - | - | |
12. | itemprop | = | string | »link »a | - | |
13. | itemref | = | string | - | - | |
14. | itemscope | = | "", , itemscope | - | - | |
15. | itemtype | = | absolute URL | - | - | |
16. | lang | = | language code | »html »head»title »img | <lang="en"> ... </ > | |
17. | spellcheck | = | "", , true, false | »html | <spellcheck="true"> ... </ > | |
18. | style | = | CSS property:value | »html »img | <style="color:red"> ... </ > | |
19. | tabindex | = | integer | »img | <tabindex="3"> ... </ > | |
20. | title | = | text | »html »link»style »abbr»dfn »img »meter | <title="html page"> ... </ > | |
21. | translate | = | "", yes, no | »html »img | <translate="yes"> ... </ > | |
All Global Attributes | ||||||
3. global event attributes | ||||||
1. | onclick | = | script | » list | <element onclick="script" > ... | |
2. | ondblclick | = | script | » list | <element ondblclick="script" > ... | |
All Event Attributes |
Video demonstration li element
HTML5 li element: add items
min | video details |
---|---|
00:08 | li element represents a list (l) item (i) |
00:13 | li element allows you to add items to: - an unordered list: ul - an ordered list: ol - or to a menu(toolbar type) |
00:19 | adding items to an unordered list |
00:19 | since we have an empty unordered list (ul) on the page, let's add some items to it through li element |
00:31 | adding content to the items |
00:43 | and the items display in browser's window |
00:51 | adding items to an ordered list |
00:51 | through li element we can add items to an ordered list (ol) also |
00:57 | and the items of the ordered list display |
01:03 | adding items to a toolbar menu |
01:03 | the same, through li element we can add items to a toolbar menu |
01:09 | menu element is not yet supported in browser; the browser display is not the expected one |