HTML <caption> alignAttribute

HTML caption 标签参考手册HTML <caption> tag

Examples

A table with a <caption> element aligned to the bottom:

<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>

Try it Yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the align attribute.

Note:

  • Internet Explorer 8 supports "left", "right", "top", and "bottom" values.
  • Internet Explorer 9+ supports "top" and "bottom" values.
  • Firefox supports "left", "right", "top", and "bottom" values.
  • Opera supports "left", "right", "top", and "bottom" values.
  • Chrome supports "top" and "bottom" values.
  • Safari supports "top" and "bottom" values.

Definition and Usage

HTML5 does not support the <caption> align attribute. Please use CSS instead.

The align attribute of <caption> is deprecated in HTML 4.01.

The align attribute specifies the alignment of the caption element.

This attribute aligns the caption as a block element to the left, right, top, or bottom of the table.


Compatibility Notes

HTML5 does not support the <caption> align attribute. Please use CSS instead.

CSS syntax: <caption style="caption-side:bottom"> or <caption style="text-align:left">

CSS Example: Positioning the Table Caption

In our CSS tutorial, you can find more details aboutcaption-sidethe attribute.


Syntax

<caption align="left|right|top|bottom">

Attribute Values

Value Description
left The caption is to the left of the table.
right The caption is to the right of the table.
top The caption is above the table.
bottom The caption is below the table.


HTML caption 标签参考手册HTML <caption> tag

Other Extensions