Html5教程 专题
专题目录
您的位置:html > Html5教程专题 > HTML5 <col> 标签
HTML5 <col> 标签
作者:--    发布时间:2019-11-20 20:03:22

html5 <col> 标签用于控制表格中的列,使你更加方便的为表格中的列应用样式。

<colgroup> 和 <col> 标签为表格中的三个列设置了背景色:

<table border="1">
  <colgroup>
    <col span="2" style="background-color:red">
    <col style="background-color:yellow">
  </colgroup>
  <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>
尝试一下 »

浏览器支持

internet explorerfirefoxoperagoogle chromesafari

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


标签定义及使用说明

<col> 标签规定了 <colgroup> 元素内部的每一列的列属性。

通过使用 <col> 标签,可以向整个列应用样式,而不需要重复为每个单元格或每一行设置样式。


html 4.01 与 html5之间的差异

html5 中不再支持 html 4.01 中的大部分属性。


html 与 xhtml 之间的差异

在 html 中,<col> 标签没有结束标签。

在 xhtml 中,<col> 标签必须被正确的关闭。


属性

属性描述
align (已废弃)
left
right
center
justify
char
html5 不支持。规定与 <col> 元素相关的内容的水平对齐方式。
char (已废弃)
characterhtml5 不支持。规定根据哪个字符来对齐与 <col> 元素相关的内容。
charoff (已废弃)
numberhtml5 不支持。规定第一个对齐字符的偏移量。
spannumber规定 <col> 元素应该横跨的列数。
valign (已废弃)
top
middle
bottom
baseline
html5 不支持。规定与 <col> 元素相关的内容的垂直对齐方式。
width (已废弃)
%
pixels
relative_length
html5 不支持。specifies the width of a <col> element


全局属性

<col> 标签支持 html 的全局属性


事件属性

<col> 标签支持 html 的事件属性

网站声明:
本站部分内容来自网络,如您发现本站内容
侵害到您的利益,请联系本站管理员处理。
联系站长
373515719@qq.com
关于本站:
编程参考手册