实例
col 元素为表格中的三个列规定了不同的对齐方式:
<table width="100%" border="1"> <col align="left" /> <col align="left" /> <col align="right" /> <tr> <th>ISBN</th> <th>Title</th> <th>Price</th> </tr> <tr> <td>3476896</td> <td>My first HTML</td> <td>$53</td> </tr> </table>
浏览器支持
元素 | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
<col> | Yes | Yes | Yes | Yes | Yes |
所有主流浏览器都支持 <col> 标签。
定义和用法
<col> 标签为表格中一个或多个列定义属性值。
如需对全部列应用样式,<col> 标签很有用,这样就不需要对各个单元和各行重复应用样式了。
您只能在 table 或 colgroup 元素中使用 <col> 标签。