Table with column group : table colgroup « Tags « HTML / CSS






Table with column group

    

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>HTML/XHTML:  &raquo; Standard HTML/XHTML Tables</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>

<div class="content">

  <table border="1" frame="box" rules="groups">
  <caption>Fun with Food</caption>
  <colgroup>
  <col />
  </colgroup>
  <colgroup>
  <col align="center" />
  <col align="char" char="." charoff="2" />
  </colgroup>
  <thead>
  <tr>
  <th bgcolor="yellow">Fruit</th>
  <th bgcolor="yellow">Color</th>
  <th bgcolor="yellow">Cost per pound</th>
  </tr>
  </thead>
  <tfoot>
  <tr>
  <th colspan="3">This has been another fine table example.</th>
  </tr>
  </tfoot>
  <tbody>
  <tr>
  <td>Grapes</td>
  <td>Purple</td>
  <td>$1.45</td>
  </tr>
  <tr>
  <td>Cherries</td>
  <td>Red</td>
  <td>$1.99</td>
  </tr>
  <tr>
  <td>Kiwi</td>
  <td>Brown</td>
  <td>$11.50</td>
  </tr>
  </tbody>
  </table>

</div>

</body>
</html>

   
    
    
    
  








Related examples in the same category

1.'colgroup' Example
2.colgroup span="10"
3.Using colgroup to group columns
4.'span' sets the number of columns in a group
5.colgroup and col tags are used to format entire columns
6.Column Groups