About the table form in html

Basic instance:

code:

<table border="1">
      <!-- 标题 -->
      <caption>
        人员管理
      </caption>
      <!-- 表头 -->
      <thead>
        <tr>
          <th>姓名</th>
          <th>性别</th>
          <th>年龄</th>
        </tr>
      </thead>
      <!-- 内容 -->
      <tbody>
        <tr>
            <td>小花</td>
            <td>女</td>
            <td>18</td>
        </tr>
        <tr>
            <td>小明</td>
            <td>男</td>
            <td>20</td>
        </tr>
        <tr>
            <td>哈哈</td>
            <td>女</td>
            <td>22</td>
        </tr>    
      </tbody>
    </table>

Effect:

Note: <thead></thead> and <tbody></tbody> and <tfoot></tfoot> can be omitted

Labels in the table:

Label Remark
<table> define table
<th> Define the header of the table
<tr> define table rows
<td> define table cells
<caption> Define the table title
<colgroup> Groups defining table columns
<col> Define properties for table columns
<thead> Defines the header (header) of the table
<tbody> Define the body of the form
<tfoot> Define the table footer

border: border line

Generally add in th/td:

colspan: horizontal merge

rowspn: vertical merge

Recommend a table generator that can directly generate tables in it and then copy the code HTML table generator (rapidtables.org)

Guess you like

Origin blog.csdn.net/lingjiaxiaozila/article/details/126050951