How to position the caption of a HTML table with CSS
Below, the captioned tables show the result of styling the types with the CSS:
/* Standard value across all major browsers */
.caption-side-top {
caption-side: top;
}
/* Standard value across all major browsers */
.caption-side-bottom {
caption-side: bottom;
}
/* At the time of writing, only works in Firefox */
.caption-side-left {
caption-side: left;
}
/* At the time of writing, only works in Firefox */
.caption-side-right {
caption-side: right;
}
The caption-side values top and bottom are already in a W3C recommendation, CSS Level 2 (Revision 1), while values left and right current sit in an editor’s draft, CSS Logical Properties and Values Level 1. Therefore, for now, if you are using left and right values, also check that the fallback to top or bottom is acceptable.