What is benefit of using thead instead of just td? If there is benefit...
What is benefit of
2020-08-09 07:57发布
相关问题
-
Views base64 encoded blob in HTML with PHP
-
Is there a way to play audio on a mobile browser w
-
HTML form is not sending $_POST values
-
implementing html5 drag and drop photos with knock
-
Why does the box-shadow property not apply to a
查看全部
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
-
Why does the box-shadow property not apply to a
THEAD
is intended to wrap all header rows. Its counterparts areTBODY
andTFOOT
. They are useful if you want to differentiate those rows via CSS or JavaScript.Using
thead
,tfoot
andtbody
let you apply special formatting to the respective parts of the table. For instance, you can include the header and the footer on all the printed pages of your table, or you can make thetbody
scroll while thethead
&tfoot
would remain static.The
thead
,tbody
, andtfoot
elements in HTML are used to group table rows into logical sections based on their content. There are two main reasons you'd want to do this:To allow the body to be scrolled independently of the header and/or footer
To make it easier to apply different style rules to the different sections of the table.
http://www.w3.org/TR/html401/struct/tables.html#h-11.2.3
The
thead
andtd
are in no way comparable. Thethead
just represents a table header and thetd
a table cell.Also see the w3schools tutorial.
A semantic benefit is that you separate the table header from the table body (and if any, also the table footer which can be represented by
<tfoot>
). The technical benefit is that you can style them separately and for example easily achieve a table with a scrollable body with a fixed header/footer by just giving the<tbody>
a fixed height and an overflow. Unfortunately MSIE is the only browser which doesn't support it.<thead>
<tbody>
and<tfoot>
mark specific sections of the table (you put rows inside of them) as being the header, body and footer of the table. This can be used to repeat headers and footers on each table (some browsers do it by default, others seem to need help). See Repeat table headers in print mode