HTML - 12 表格标签

本教程原出处:网道
本教程文档在原作基础上进行了一定的补充、修改和完善,以满足个人学习、工作中的需要,亦可作为个人口袋书使用。
本教程文档中的原文部分,其版权仍归原作者所有。
本教程文档仅作个人学习、教学和工作使用,任何他人、或机构、组织不得恶意传播、复制本文档,或将本教程文档用做商用

表格标签

  • 表格(table)以行(row)和列(column)的形式展示数据。
  • <table>,<caption>在这里插入图片描述
  • <thead>、<tbody>、<tfoot>在这里插入图片描述
  • <colgroup>,<col>在这里插入图片描述在这里插入图片描述
  • <tr>
    在这里插入图片描述
  • <th>,<td>
    在这里插入图片描述
  • colspan属性,rowspan属性
    在这里插入图片描述
  • headers属性
    在这里插入图片描述
  • scope属性
  • scope属性只有<th>标签支持,一般不在<td>标签使用,表示该<th>单元格到底是栏的标题,还是列的标题。
<table>
  <tr>
    <th scope="col">姓名</th>
    <th scope="col">学号</th>
    <th scope="col">性别</th>
  </tr>
  <tr>
    <th scope="row">张三</th>
    <td>001</td>
    <td></td>
  </tr>
  <tr>
    <th scope="row">李四</th>
    <td>002</td>
    <td></td>
  </tr>
</table>

在这里插入图片描述

  • 下面是一个colgroup属性和rowgroup属性的例子。
<table>
  <thead>
    <tr>
      <th scope="col">海报名称</th>
      <th scope="col">颜色</th>
      <th colspan="3" scope="colgroup">尺寸</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th rowspan="3" scope="rowgroup">Zodiac</th>
      <th scope="row">Full color</th>
      <td>A2</td>
      <td>A3</td>
      <td>A4</td>
    </tr>
    <tr>
      <th scope="row">Black and white</th>
      <td>A1</td>
      <td>A2</td>
      <td>A3</td>
    </tr>
    <tr>
      <th scope="row">Sepia</th>
      <td>A3</td>
      <td>A4</td>
      <td>A5</td>
    </tr>
  </tbody>
</table>

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值