1 Minute HTML CSS Part 10 – Table Sections & Groups

TABLE SECTIONS

<style>
thead { background: red; }
tbody { background: green; }
tfoot { background: blue; }
</style>
 
<table>
  <thead>
    <tr><th>HEAD</th> <th>HEAD</th></tr>
  </thead>
  <tbody>
    <tr><td>CELL</td> <td>CELL</td></tr>
  </tbody>
  <tfoot>
    <tr><td>CELL</td> <td>CELL</td></tr>
  </tfoot>
</table>
  • <thead> Header section.
  • <tbody> Body section.
  • <tfoot> Footer section.
  • These are more used for styling – Which we will cover in a later chapter.

 

COLUMN GROUPS

<table>
  <colgroup>
    <col>
    <col span="2" style="background: yellow">
  </colgroup>
  <tr>
    <td>CELL</td> <td>CELL</td> <td>CELL</td>
  </tr>
</table>
  • <colgroup> Define a column group, it must be inserted inside <table>.
  • <col span="N"> Define a group of columns. Used for styling once again.