「HTML和CSS入门指南」th 标签详解

什么是 th 标签?

        在 HTML 中,th 标签用于创建表格中的表头单元格。表头单元格通常用于标识每列中的数据,并且与普通单元格不同之处在于它们具有更强的语义含义。


th 标签的基本语法

以下是 th 标签的基本语法:

<table>
  <thead>
    <tr>
      <th>姓名</th>
      <th>年龄</th>
      <th>性别</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>张三</td>
      <td>28</td>
      <td>男</td>
    </tr>
    <tr>
      <td>李四</td>
      <td>35</td>
      <td>女</td>
    </tr>
  </tbody>
</table>

其中:

  • <table> 标签用于创建表格。
  • <thead> 标签用于标识表格的表头部分。
  • <tr> 标签用于创建表格中的行。
  • <th> 标签用于创建表头单元格。
  • <tbody>

猜你喜欢

转载自blog.csdn.net/a451319296/article/details/131033249
今日推荐