天天看点

HTML <colgroup> align 属性

HTML <colgroup> align 属性

HTML <colgroup> 标签

两个 <colgroup> 元素为表格中的三列规定了不同的对齐方式(注意第一个 <colgroup> 元素横跨两列):

<table width="100%" border="1">

  <colgroup span="2" align="left"></colgroup>

  <colgroup align="right"></colgroup>

  <tr>

    <th>ISBN</th>

    <th>Title</th>

    <th>Price</th>

  </tr>

    <td>3476896</td>

    <td>My first HTML</td>

    <td>$53</td>

</table>

HTML <colgroup> align 属性
HTML <colgroup> align 属性
HTML <colgroup> align 属性
HTML <colgroup> align 属性
HTML <colgroup> align 属性

只有 Opera 和 Internet Explorer 8 及之前的版本(IE 9 不支持)支持 align 属性(IE 9 不支持)。

在 HTML5 中,不支持 <colgroup> align 属性。

align 属性规定列组中的内容的水平对齐方式。

<colgroup align="left|right|center|justify|char">

描述

left

左对齐内容(默认值)。

right

右对齐内容。

center

居中对齐内容(th 元素的默认值)。

justify

对行进行伸展,这样每行都可以有相等的宽度(就像在报纸和杂志中)。

char

将内容对准指定字符。

HTML <colgroup> align 属性