Center Align Table Headings
To center align content in table headings using CSS, set CSS text-align property for the table headings th, with the value center.
The CSS code to set text alignment for table headings to center is showing in the following.
th { text-align: center; }
Examples
ADVERTISEMENT
1. Table headings center alignment
In the following example, we take a table with two columns, and three rows; and set the text alignment to center for the table headings.
index.html
Conclusion
In this CSS Tutorial, we learned how to use CSS text-align
property to center align content in the table headings, with examples.