fezaoduke / fe-practice-hard

晚练课
69 stars 6 forks source link

第 112 期(W3C 标准-HTML):table的colgroup和col #115

Open wingmeng opened 5 years ago

wingmeng commented 5 years ago

<colgroup> 标签用来定义表格列的分组,<col> 的作用是细化 <colgroup> 分组,因为即使在一个组中,列与列之间也可能会出现一些差别。例如一个表格前三列要垂直靠上,后两列垂直靠下。 <colgroup><col> 这两个标签在 Chrome、FireFox、Safari 等浏览器中只支持背景色、span、宽度等少数几种样式属性,只有在IE浏览器才能获得完全支持。

> 在线示例 <

image

<table class="ui-table">
  <colgroup style="width:100px; background:#eee;">
    <col style="background:#c00">
    <col style="background:#090">
    <col style="width:60px; background:#069">
  </colgroup>
  <colgroup span="2" style="background:#fc0"></colgroup>
  <thead>
    <tr>
      <th>第1列</th>
      <th>第2列</th>
      <th>第3列</th>
      <th>第4列</th>
      <th>第5列</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>第1列</td>
      <td>第2列</td>
      <td>第3列</td>
      <td>第4列</td>
      <td>第5列</td>
    </tr>
    <tr>
      <td>第1列</td>
      <td>第2列</td>
      <td>第3列</td>
      <td>第4列</td>
      <td>第5列</td>
    </tr>
    <!-- 略 -->
  </tbody>
</table>