th background-color: gold; : th background « Tags « HTML / CSS






th background-color: gold;

     
<html>
<head><title>Tables</title>
<style type="text/css">
td {
  text-align: center;
  font-weight: bold;
}

table {
  background-color: blue;
  color: white;
}

caption {
  background-color: red;
  color: yellow;
  font-weight: bold;
}

th {
  background-color: gold;
  color: navy
}

td.center {
  background-color: white;
  color: black;
}
</style></head>

<body>
<table>
    <caption>How to Use Tables</caption>
  <tr>
      <th>Col 1</th>
      <th>Col 2</th>
      <th>Col 3</th>
  </tr>
  <tr>
      <td>X</td>
      <td>X</td>
      <td>X</td>
  </tr>
  <tr>
      <td>X</td>
      <td class="center">X</td>
      <td>X</td>
  </tr>
  <tr>
      <td>X</td>
      <td>X</td>
      <td>X</td>
  </tr>
</table>
</body>
</html>

   
    
    
    
  








Related examples in the same category

1.Add background for table header
2.Add background image for table header
3.Add different background images for each table column header
4.Background for table header row
5.table header background-color: #cccccc;
6.th background: #e7e6e6 url(MarketPlace-images/button.jpg) repeat-x;
7.th background: #882D2D;
8.th background: #F3F3F3;
9.th background-color:#d6d6d6;
10.th background-color: #CDC1A7;
11.th background: lightsteelblue;