Latest web development tutorials

HTML colgroup align 屬性

HTML colgroup 標籤參考手冊 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>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
</table>

嘗試一下»

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

只有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 標籤參考手冊 HTML <colgroup>標籤