Latest web development tutorials

HTML th align 屬性

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

實例

向左對齊表頭單元格中的內容:

<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>

嘗試一下»

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流瀏覽器都支持align 屬性。

注意:幾乎沒有瀏覽器能夠正確地處理"char"值。


定義和用法

HTML5不支持<th> align屬性。 請使用CSS代替。

align 屬性規定表頭單元格中內容的水平對齊方式。


語法

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

屬性值

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


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