English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
本文介绍HTML colgroup align属性指定列组中内容的水平对齐方式。在 HTML5 In HTML, the align attribute of <colgroup> is not supported.
两个<colgroup>元素,它们为表中的三列指定不同的对齐方式(请注意,第一个<colgroup>元素跨越两列):
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML <colgroup> char 属性使用-基础教程(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="."></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
Only Opera and Internet Explorer 8 and earlier versions (IE 9 Not supported) supports the align attribute (IE 9 Not supported).
In HTML5 In HTML, the align attribute of <colgroup> is not supported.
The align attribute specifies the horizontal alignment of the content within the column group.
<colgroup align="left|right|center|justify|char">
Value | Description |
---|---|
left | Left align the content (the default value). |
right | Right align the content. |
center | Center align the content (the default value of the th element). |
justify | Stretch the line so that each line can have an equal width (as in newspapers and magazines). |
char | Align content to a specified character. |