1. 程式人生 > 其它 >table 表格中 colgroup 和 col 標籤

table 表格中 colgroup 和 col 標籤

技術標籤:HTML.CSS專區htmlhtml5

<col>標籤是給表格中一個或多個列定義屬性值,而<colgroup>標籤是對錶格中的列進行組合,從而實現對錶格的格式化。<col>標籤一般會放在<colgroup>標籤中使用,對<colgroup>標籤組合的列分別設定樣式。<colgroup>標籤也可以有樣式屬性,是對組合的列設定相同的樣式,<colgroup>標籤設定的樣式會被<col>標籤設定的樣式覆蓋。

格式:
<colgroup span=“跨幾列”>
<col 屬性1=“屬性值1” 屬性2=“屬性值2”…/>

<col 屬性1=“屬性值1” 屬性2=“屬性值2”…/>
</colgroup>

<table class="lytable-table">
   <colgroup>
        <col width="110">
        <col width="110">
        <col width="40">
        <col width="80">
        <col width
="40">
</colgroup> <thead> <tr> <th>維護專案</th> <th>維護分項</th> <th>次數</th> <th>週期</th> <th>月份</th> </tr> </thead> <
tbody
class="lytable-table__body">
<tr> <td>維護專案</td> <t>維護分項</td> <td>次數</td> <td>週期</td> <td>月份</td> </tr> </tbody> </table>

HTML <colgroup> 標籤 :傳送門
HTML <col> 標籤:傳送門