Is it required to use thead, tbody and tfoot tags?
The tabular data spec for HTML5 does not require them:
Contexts in which this element (
tr
) can be used:
- As a child of a
thead
element.- As a child of a
tbody
element.- As a child of a
tfoot
element.- As a child of a
table
element, after anycaption
,colgroup
, andthead
elements, but only if there are notbody
elements that are children of the table element.
Even though I believe it is a good practice to section your rows within thead
, tbody
and tfoot
tags as it makes the table's rows easier to identify.
In the end, the browser will always add at least the tbody
for you.
No. Modern browsers will add these by default.
Those tags are not required. It is considered good form to use them if the table is used to represent data, which is what a table should be used for. If a table is used for laying out content they are typically omitted.
W3C