-
Step 1
Choose a name for the set of code you will use in your style sheet to change a table's background color. In CSS terminology, the name for a set of code is referred to as a class. You might name the class "tablesample."
-
Step 2
Choose a color for the background of your table. You might choose the color blue.
-
Step 3
Write the code for your tablesample class designating the color you have chosen. Follow the required syntax for style sheets:
<!--
.tablesample { background-color: blue; }
--> -
Step 4
Add the code for your tablesample class to your basic style sheet code:
<style type="text/css">
<!--
.tablesample { background-color: blue; }
-->
</style> -
Step 5
Assign the tablesample class in the table's opening tag to any table for which you want to change the background color to blue:
<table class="tablesample">
<tr>
<td>
Information here.
</td>
</tr>
</table>
The table's background color will be changed to blue.







