Set Background Color for Table Headings
To set a specific background color for the table headings using CSS, set CSS background-color property for the table heading th, with the required Color Value, like red, green, #f00, #ff552241, rgb(41, 85, 12), etc.
The CSS code to set background color for table headings is showing in the following.
th { background-color: yellow; }
Examples
ADVERTISEMENT
1. Set yellow as background-color for table headings
In the following example, we take a table with two columns, and three rows; and set the background color of the table headings with yellow
.
index.html
Conclusion
In this CSS Tutorial, we learned how to use CSS background-color
property to set a specific background color for the table headings, with examples.