跳到主要内容

align


HTML <th> align 属性

警告

注意:几乎没有浏览器能够正确地处理 "char" 值。

向左对齐表头单元格中的内容:

<table width="100%" border="1">
<tr>
<th align="left">Month</th>
<th align="left">Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>

定义和用法

注意

HTML5 不支持 <th> align 属性。请使用 CSS 代替。

align 属性规定表头单元格中内容的水平对齐方式。


语法

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

属性值

描述
left左对齐内容。
right右对齐内容。
center居中对齐内容(<th> 的默认值)。
justify对行进行伸展,这样每行都可以有相等的宽度(就像在报纸和杂志中)。
char将内容对准指定字符。

浏览器兼容性

Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
align
Deprecated