html?<colgroup>? 标签 用于对表格中的列进行组合,以便对其进行格式化
使用 <colgroup> 标签 可以向整个列应用样式,而不需要重复为每个单元格或每一行设置样式
只能在 <table> 元素之内,在任何 一个 <caption> 元素之后,在任何 一个 <thead>、<tbody>、<tfoot>、<tr> 元素之前使用 <colgroup> 标签
如果想对 <colgroup> 中的某列定义不同的 属性 ,可以在 <colgroup> 标签 内使用?<col>? 标签
属性
属性
值
描述
align
left
right
center
justify
char
html5 不支持
设置在列组合中 内容 的水平对齐方式
char
ch ara cter
HTML5 不支持
设置根据哪个字符来对齐列组中的 内容
charoff
number
HTML5 不支持
设置第 一个 对齐字符的偏移量
span
number
设置列组应该横跨的列数
valign
top
middle
b ott om
baseline
HTML5 不支持
定义在列组合中 内容 的垂直对齐方式
width
pixels
%
relative_length
HTML5 不支持
设置列组合的宽度
范例
<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?f irs t?HTML</td> ????<td>$53</td> ??</tr> </table>HTML <command> 标签 ? ?HTML <code> 标签
查看更多关于HTML <colgroup> 标签的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did92265