HTML Tables
and Captions
When displaying tabular data, structure is everything. However, visual structure isn't enough. We need to explain what the table represents. This is where the <caption> tag comes in.
What is a Caption?
The <caption> element specifies the title of a table. It is helpful for all users, but especially for those using screen readers, as the caption is often announced before the table data is traversed.
Proper Placement
There is only one correct place for a <caption>: immediately after the opening <table> tag. You can only have one caption per table.
Styling and Behavior
By default, a caption will be centered above the table. However, using CSS property caption-side, you can move it to the bottom if the design requires it.
