Alternating row colors : table row : Table Style HTML CSS TUTORIALS


HTML CSS TUTORIALS » Table Style » table row »

 

Alternating row colors


 

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitionalt//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
  <title>Alternating row colors</title>
  <style rel="stylesheet" type="text/css">
th {
  font-weight: bold;
  text-align: left;
  background-color: #fff336;
}

td {
  padding: 3px;
}

.odd {
  background-color: #efefef;
}

.even {
  background-color: #ffffff;
}
</style>
</head>
<body>
<h2>Alternating Row Colors</h2>
<table>
  <tr>
    <th>Item</th>
    <th>Description</th>
    <th>Cost</th>
    <th>Subtotal</th>
  </tr>
  <tr class="even">
    <td>I</td>
    <td>B</td>
    <td>1</td>
    <td>1</td>
  </tr>
  <tr class="odd">
    <td>B</td>
    <td>B</td>
    <td>.2</td>
    <td>1</td>
  </tr>
  <tr class="even">
    <td>E</td>
    <td>2</td>
    <td>2</td>
    <td>1</td>
  </tr>
  <tr class="odd">
    <td>P</td>
    <td>1</td>
    <td>1</td>
    <td>2</td>
  </tr>
  <tr class="even">
    <td>V</td>
    <td>5</td>
    <td>2</td>
    <td>2</td>
  </tr>
  <tr class="odd">
    <td>B</td>
    <td>L</td>
    <td>1</td>
    <td>2</td>
  </tr>
  <tr class="even">
    <td>E</td>
    <td>1</td>
    <td>0</td>
    <td>2</td>
  </tr>
</table>
</body>
</html>

 



HTML code for linking to this page:

Follow Navioo On Twitter

HTML CSS TUTORIALS

 Navioo Table Style
» table row