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 屬性規(guī)定表格行中的內(nèi)容的水平對齊方式。


語法

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

屬性值

描述
left 左對齊內(nèi)容(<td> 元素的默認值)。
right 右對齊內(nèi)容。
center 居中對齊內(nèi)容(<th> 元素的默認值)。
justify 對行進行伸展,這樣每行都可以有相等的寬度(就像在報紙和雜志中)。
char 將內(nèi)容對準指定字符。


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