HTML <table> 標籤的 align 屬性
實例
一個右對齊的 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>
定義和用法
align 屬性規定表格相對於周圍元素的對齊方式。
通常來說,HTML 表格的前後都會出現折行。通過運用 align 屬性,可實現其他 HTML 元素圍繞表格的效果。
相容性註釋
在 HTML 4.01 中,不贊成使用 body 元素的 align 屬性;在 XHTML 1.0 Strict DTD 中,不支援 body 元素的 align 屬性。
請使用 CSS 代替。
CSS 語法:<table style="float:right">
在我們的 CSS 教程中,您可以找到更多有關 float 屬性的細節。
語法
<table align="value">
屬性值
值 | 描述 |
---|---|
left | 左對齊表格。 |
right | 右對齊表格。 |
center | 居中對齊表格。 |