HTML <table> align 屬性
實(shí)例
一個(gè)右對(duì)齊的 HTML 表格:
<table border="1"
align="right">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
嘗試一下 ?
瀏覽器支持
所有主流瀏覽器都支持 align 屬性。
定義和用法
HTML5 不支持 <table> align 屬性。請(qǐng)使用 CSS 代替。
在 HTML 4.01 中,<table> 的 align 屬性已廢棄。
align 屬性規(guī)定表格相對(duì)于周圍文本的對(duì)齊方式。
通常來說,HTML 表格的前后都會(huì)出現(xiàn)折行。通過運(yùn)用 align 屬性,可實(shí)現(xiàn)其他 HTML 元素圍繞表格的效果。
兼容性注釋
在 HTML 4.01 中,<table> 的 align 屬性已廢棄,請(qǐng)使用 CSS 代替。
CSS 語法:<table style="float:right">
在我們的 CSS 教程中,您可以找到更多有關(guān) float 屬性 的細(xì)節(jié)。
語法
<table align="left|right|center">
屬性值
值 | 描述 |
---|---|
left | 左對(duì)齊表格。 |
right | 右對(duì)齊表格。 |
center | 居中對(duì)齊表格。 |

更多建議: