HTML <caption> 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 <caption> align 属
实例
带有与底部对齐的 <caption> 元素的表格:
<table border="1">
<caption align="bottom">My savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
<caption align="bottom">My savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
浏览器支持
所有主流浏览器都支持 align 属性。
注意:
- Internet Explorer 8 支持 "left", "right", "top", 和 "bottom" 值。
- Internet Explorer 9+ 支持 "top", 和 "bottom" 值。
- Firefox 支持 "left", "right", "top", 和 "bottom" 值。
- Opera 支持 "left", "right", "top", 和 "bottom" 值。
- Chrome 支持"top", 和 "bottom" 值。
- Safari 支持 "top", 和 "bottom" 值。
定义和用法
HTML5 不支持 <caption> align 属性。请使用 CSS 替代。
<caption> 的 align 属性在 HTML 4.01 中已废弃。
align 属性规定 caption 元素的对齐方式。
该属性将 caption 作为块元素向表格的左边、右边、顶部、底部进行对齐。
兼容性注释
THTML5 不支持 <caption> align 属性。请使用 CSS 替代。
CSS 语法: <caption style="caption-side:bottom"> or <caption style="text-align:left">
在我们的 CSS 教程中,您可以找到更多有关caption-side 属性的细节。
语法
<caption align="left|right|top|bottom">
属性值
| 值 | 描述 |
|---|---|
| left | 标题在表格的左边。 |
| right | 标题在表格的右边。 |
| top | 标题在表格的上边。 |
| bottom | 标题在表格的下边。 |