好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

html中<col>标签的使用详解

html5中<col>标签作用是定义表格中一个或多个列属性值,这里详细介绍下<col>标签用法、<col>标签属性以及<col>标签应用实例。

html中<col>标签作用:定义表格中一个或多个列属性值

<col>标签用法:

<col> 标签为表格中一个或多个列定义属性值。

如需对全部列应用样式,<col> 标签很有用,这样就不需要对各个单元和各行重复应用样式了。

您只能在 table 或 colgroup 元素中使用 <col> 标签。

<col>标签应用实例:

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> 

<col>标签有哪些属性?

哪些浏览器支持<col>标签?

所有主流浏览器都支持<col>标签。

html中col标签的实例

<html>
<body>
<table border="2">
<col span="2" style="color:red">
<col style="color:blue">
<tr>
<td>红色</td>
<td>红色</td>
<td>蓝色</td>
</tr>
<tr>
<td>红色</td>
<td>红色</td>
<td>蓝色</td>
</tr>
</table>
</body>
</html> 

这样就可以给每一列设置样式,而不用在每个td里面设置。

第一二两列是红的。第三列是蓝的。

以上就是html中<col>标签的使用详解的详细内容,更多请关注Gxl网其它相关文章!

查看更多关于html中<col>标签的使用详解的详细内容...

  阅读:44次