HTML <table> align 属性
标签" href="tag-main.html"><main>
<map>
<mark>
<menu>
<meta>
<meter>
<nav>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<html>
<picture>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike>
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<textarea>
< template>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt>
<u>
<ul>
<var>
<video>
<wbr>
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>
<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 属性。请使用 CSS 代替。
在 HTML 4.01 中,<table> 的 align 属性 已废弃。
align 属性规定表格相对于周围文本的对齐方式。
通常来说,HTML 表格的前后都会出现折行。通过运用 align 属性,可实现其他 HTML 元素围绕表格的效果。
兼容性注释
在 HTML 4.01 中,<table> 的 align 属性已废弃,请使用 CSS 代替。
CSS 语法:<table style="float:right">
在我们的 CSS 教程中,您可以找到更多有关 float 属性 的细节。
语法
<table align="left|right|center">
属性值
| 值 | 描述 |
|---|---|
| left | 左对齐表格。 |
| right | 右对齐表格。 |
| center | 居中对齐表格。 |
HTML <table> 标签