English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
In HTML5 中,不支持 <colgroup> charoff 属性。charoff属性设置将内容与char属性指定的字符对齐的字符数。只有在指定了char属性并且align属性设置为“char”的情况下,才能使用charoff属性。
在下面的示例中,表格中第二列的内容与字符 "." 向右两个字符的位置对齐:
!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML <colgroup> charoff 属性使用-基本教程(oldtoolbag.com)</title> <style>table, th, td { border: 1px solid black;}</style> </head> <body> <table style="width:100%"> <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> </body> </html>Test See ‹/›
IEFirefoxOperaChromeSafari
Note:Almost all mainstream browsers do not support the charoff attribute.
In HTML5 In, the charoff attribute of <colgroup> is not supported.
The charoff attribute sets the number of characters to align the content with the character specified by the char attribute.
The charoff attribute can only be used when the char attribute is specified and the align attribute is set to 'char'.
<colgroup charoff="number">
Value | Description |
---|---|
number | Specify the alignment method. Positive numbers are aligned to the right of the character. Negative numbers are aligned to the left of the character. |