The content of this article is about a brief analysis of how to use HTML Table. It has good reference value. I hope it can help friends in need.
table
tag defines an HTML table.
table
, tr
, th
, td
<table>
<p>The entire table starts with the <code><table> tag and ends with the <code>
tag.
<tr>
<p>Table row. There are several pairs of tr in a row of a table, and there are several rows in a table. </p>
<h3><code><td>
<p>Table data. A cell of the table contains several pairs of td in one row and several columns in one row. </p>
<h3><code><th>
<p>Table head. A cell at the head of the table, table header. </p>
<h2>Extra elements</h2>
<h3><code><tbody>, <code><thead>, <code><tfoot><p>Table structure, if <code><thead> </thead>
<tbody> <tfooter> is not added, the table will be displayed after loading. With these additions, <code>tbody
the content containing rows is displayed first, without waiting for the end of the table to be displayed. tbody
to segment it and display it part by part. <caption></caption>
Table title
border
The width of the table border.
It is recommended to set it to 0 and then add the border style by yourself using CSS.
cellpadding
The spacing (padding) between the table cell boundary and the cell content.
It is recommended to set it to 0 and then add padding style using CSS by yourself.
cellspacing
The spacing between cells.
Using CSS3:nth-child(n)
The pseudo-class selector can achieve the effect of changing the color of alternate rows in the table.
n You can fill in odd, even or any number, representing odd rows/columns, even rows/columns or specified rows/columns respectively
Related recommendations:
HTML format And tag introduction
How to briefly describe the basic structure of html (with code)
The above is the detailed content of A brief analysis of how to use HTML Table. For more information, please follow other related articles on the PHP Chinese website!