Table and table cell backgrounds : td background « Tags « HTML / CSS






Table and table cell backgrounds

     

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Table and table cell backgrounds</title>
  <style type="text/css" media="all">
    table {
      font: 1em/1.5em Georgia, serif;
      background-color: rgb(230,230,230);
      border: 1px solid black;
      margin: 1em;
      border-collapse: separated;
    }
    td {
      vertical-align: baseline;
      padding: 0 0.5em;
      border: 1px dashed black;
    }
    td.background {
      background-color: rgb(200,200,200);
    }
  </style>
</head>
<body>
  <table>
    <tr>
      <td>Lorem ipsum dolor</td>
      <td>Lorem ipsum dolor</td>
      <td>Lorem ipsum dolor</td>
    </tr>
    <tr>
      <td>Lorem ipsum dolor</td>
      <td class="background">Lorem ipsum dolor</td>
      <td>Lorem ipsum dolor</td>
    </tr>
    <tr>
      <td class="background">Lorem ipsum dolor</td>
      <td>Lorem ipsum dolor</td>
      <td class="background">Lorem ipsum dolor</td>
    </tr>
  </table>
</body>
</html>

   
    
    
    
  








Related examples in the same category

1.td background-color: gold;
2.td background-color:#efefef;
3.th background: lightyellow;
4.td background: url(img/menubg.gif) repeat-x bottom left #f4f4f4;
5.td:empty background: gray;
6.td background: lightyellow;
7.Column Background
8.col background: rgb(244, 244, 244);