Latest web development tutorials

HTML colgroup charoff 屬性

HTML colgroup 標籤參考手冊 HTML <colgroup>標籤

實例

在下面的實例中,表格中第二列的內容與字符"." 向右兩個字符的位置對齊:

<table width="100%" border="1">
<colgroup align="left"></colgroup>
<colgroup align="char" char="." charoff="2"></colgroup>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100.00</td>
</tr>
<tr>
<td>February</td>
<td>$10.00</td>
</tr>
</table>

嘗試一下»

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

注意:幾乎所有的主流瀏覽器都不支持charoff屬性。


定義和用法

在HTML5中,不支持<colgroup> charoff屬性。

charoff 屬性規定內容相對於由char 屬性規定的字符的對齊偏移量。

僅當align 屬性設置為"char" 且已設置char 屬性時,才能使用charoff 屬性。


語法

<colgroup charoff="number">

屬性值

描述
number 规定对齐方式。
正数规定向字符的右边对齐。
负数规定向字符的左边对齐。


HTML colgroup 標籤參考手冊 HTML <colgroup>標籤