The definition and usage of HTML thead tag

Time:2021-4-20

Copy code

The code is as follows:

< thead > <! – think of the first two lines as the head area – >
<tr>
<td rowspan=”2″></td>
<td rowspan=”2″></td>
<td rowspan=”2″></td>
<td colspan=”3″></td>
<td scope=”col” colspan=”2″ rowspan=”2″></td>
</tr>
</thead>

I want to ask why the comments in the code < thead > <! – regard the first two lines as the head area – > regard the first two lines as the head area, which means that the element thead itself defaults to two lines? Or something else?
Also, does scope = “col” mean to lock a range in a column? What’s the point of doing this?
This should be combined with rowspan = “2”, and the head simply represents the table head

HTML < thead > label
Definition and Usage :
The < thead > tag defines the header of the table. This tag is used to combine the header contents of an HTML table.
The thead element should be used in combination with the tbody and tFoot elements.
The tbody element is used to group the main content in the HTML table, while the tFoot element is used to group the annotation (page footers) content in the HTML table.
Note: if you use the thead, tFoot, and tbody elements, you must use all of them. They appear in the order: thead, tFoot, tbody, so that the browser can render the footers before receiving all the data. You must use these tags inside the table element.
Tip: by default, these elements do not affect the layout of the table. However, you can use CSS to make these elements change the appearance of the table.
Detailed description:
The thead, tFoot, and tbody elements give you the ability to group rows in a table. When you create a table, you may want to have a header row, some rows with data, and a total row at the bottom. This partition enables the browser to support table body scrolling independent of the table title and page footers. When a long table is printed, the table header and page footers can be printed on each page containing the table data.
Example: HTML table with thead, tbody, and tFoot elements:

Copy code

The code is as follows :

<table border=”1″>
<thead>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Sum</td>
<td>$180</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</tbody>
</table>

Recommended Today

Deeply analyze the principle and practice of RSA key

1、 Preface After experiencing many dark moments in life, when you read this article, you will regret and even be angry: why didn’t you write this article earlier?! Your darkest moments include: 1. Your project needs to be connected with the bank, and the other party needs you to provide an encryption certificate. You have […]