Table tags in HTML

The layout of the table and the display of data are more used to display data.
The basic syntax of the table:

<p>表格的几个部分 table表格、thead表头、tbody主体、tfoot表尾 </p>
!--表格-->
<table align="center" border="1" cellpadding="50" cellspacing="0" width="600px" >
    <thead>
        <tr>
            <th>1</th>
            <th>2</th>
            <th>3</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>4</td>
            <td>5</td>
            <td>6</td>
        </tr>
        <tr>
            <td>7</td>
            <td>8</td>
            <td>9</td>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <td>a</td>
            <td>b</td>
            <td>c</td>
        </tr>
    </tfoot>
</table>

Effect picture: The
Insert picture description here
table label is defined as a table label, the tr label is defined as a row in the table, th and td are the columns in the table, but the th label belongs to the table header label, compared with the td label, the content of the th label is much Bold centered style;
thead tag is used to define the head of the table, there must be a tr tag inside, generally used for the first row;
tbody tag is used to define the body of the table, mainly used to place the data body;
from the perspective of the body The content of the tbody
tag and the tfoot tag at the end of the table are not much different. Generally, the tfoot tag is omitted, and the tail content is directly written in the tbody tag; thead tag and tfoot tag are placed in the table tag.

Table properties:

Attributes description
align Alignment (left, center, right)
width The width of the table (pixel value or percentage)
height Table height (pixel value or percentage)
border The border of the table, the default is "", no border
cellpadding Distance between cell content and cell border, default is 1
cellspacing The distance between the cell and the cell, the default is 2
bgcolor Table background color
bordercolor Table border color
Published 13 original articles · Likes2 · Visits 325

Guess you like

Origin blog.csdn.net/weixin_46410264/article/details/104597789
Recommended