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 not used very often. It identifies a section of atable
that is the "header" and is sort of a hint to the browser that the user might want to see this piece, even if he scrolls the rest of the table up and down. http://www.w3schools.com/tags/tag_thead.aspHere is one advantage I found. Say you want to print a web-page that has so much rows that the whole table fits in more than one page (when you want it to be printed).
thead
will actually cause the browser to include the table header in all the pages(to which the table extends) and hence improve readability. You can read it hereFrom the w3c specification:
Hope this helps.
I don't see it mentioned here yet, but another benefit is that in most browsers you can actually code
<thead>
,<tfoot>
, and<tbody>
out of order and they will appear in the right place on the table. While obscure, I have taken advantage of this before. For example:I wanted a total number of rows listed in the header, so I incremented a counter in my
foreach()
and put the<thead>
at the bottom, so that I could use the value of$count
in my header.Certainly not the main benefit, but a benefit nonetheless.