HTML Table Caption

HTML Table Caption is used to display a text on the top or bottom side of the table. Also, the alignment of the caption can be set using text-align property.

Examples

In the following example, we specify the caption for table using <caption> tag.

index.html

As in the above output, the default location of caption is top center.

Caption Side Bottom

Now, let us change the location of caption to bottom of table using caption-side in style property.

index.html

Align Caption to Left

In the following example, we align the caption to left using text-align property.

index.html

Similarly, we can align the caption to right side of the table.

ADVERTISEMENT

Conclusion

In this HTML Tutorial, we learned about HTML Table Caption, and how to place it at the top or bottom of table, with examples.