table ... ⁄table
HTML5 table element
The table element allows you to render tables in your HTML document. »video
About table
- is an optional element
- multiple table elements allowed per HTML5 document
Display & support table
- display in browser »video
- display type: block





Parents, children table
- table nested within elements »table parents
- elements nested within table »table children
»examples
Attributes table
- required: none
- optional: specific attributes, global attributes, event attributes
Syntax table
1 | <> ... </> »video |
Attributes and Values table (comma separated)
< | attribute | = | "attribute_value(s)" | > | Video | Examples |
---|---|---|---|---|---|---|
1. specific attributes | ||||||
1. | border | = | 1, "" | » video | <border="1"> ... <⁄ > | |
2. | sortable | = | "", , sortable | - | <sortable> ... <⁄ > | |
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 table element
HTML5 table element: render tables
min | video details |
---|---|
00:04 | video tutorial: rendering a table in our html page |
00:10 | like this one; we will recreate this table from scratch |
00:17 | we will start by adding the table element in page which acts like a container, since it will contain all other elements needed |
00:33 | our container is empty → nothing to display in browser |
00:38 | "Moon Phases, March and April, 2013" represents the caption of the table, which can be added in page through caption element; note: caption element is optional |
00:39 | recreating this table |
01:01 | this represents the head of the table and can be added in page through thead element; note: thead is optional |
01:16 | this represents the body of the table and can be added in page through tbody element note: tbody is optional; when absent, tr element must be present as child of the table element |
01:19 | this represents the footer of the table and can be added in page through tfoot element note: tfoot is optional |
01:37 | thead, tbody and tfoot don't display in browser |
01:42 | thead element contains: 1 row (1 tr element) with 4 header cells (4 th elements) |
02:29 | our table's header displays in browser |
02:34 | tbody element contains 2 rows (2 tr elements) with 4 cells each (4 td elements) |
03:20 | the 2 rows with 4 cells each displays, but the cells are empty for now |
03:31 | adding content inside the cells |
03:59 | the body of our table displays in browser |
04:04 | tfoot element contains 1 row (1 tr element) with 4 cells (4 th elements) |
04:36 | the footer of our table displays also |
04:41 | we recreated the table |