HTML caption align Attribute
HTML <caption> tag
Definition and Usage
The align attribute specifies horizontal and vertical position of the
caption element relative to the table element.
Compatibility Notes
The align attribute of the caption element was deprecated in HTML 4.01
and is not supported in XHTML 1.0 Strict DTD.
Use CSS instead.
CSS syntax: <caption style="caption-side:right">
In our CSS tutorial you can find more details about the
caption-side property.
Syntax
<caption align="alignment">
|
Syntax Example
Attribute Values
Value |
Description |
left |
The caption text will be shown on the left side of the
table. |
right |
The caption text will be shown on the right side of the
table. |
top |
The caption text will be shown on the top side of the
table. |
bottom |
The caption text will be shown on the bottom side of the
table. |
Browser Support
The attribute is deprecated, and only Firefox shows this attribute correctly.
Use CSS instead.
Example
Source |
Output |
<table border="1">
<caption align="right">
This is a caption</caption>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
</table>
|
This is a caption
Cell 1 |
Cell 2 |
|
Try-It-Yourself Demos
caption
align attribute example
Set the caption text position with the caption align attribute.
In CSS:
caption
position example
Set the caption text alignment with CSS.
HTML <caption> tag
|