Latest web development tutorials

HTML tr align 屬性

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

實例

帶有居中對齊行的HTML 表格:

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

嘗試一下»

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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

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


定義和用法

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

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


語法

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

屬性值

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


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