Tables : Lesson 2

Column Span and Row Span
Column Span means you combine two or more columns and make a single column for that row.

Row Span means you combine two or more rows and make a single row for that column.

These are very useful. Lets have an example.

Interest Rates
Account Details
Account Type Rate Length
Young Saver 2% 1 year
Smart 3% 2 years
Long Haul 4.5% 4 years

 
<table border = "1">
<caption>
 Interest Rates
</caption>
  <tr> 
      <th colspan="3">Account Details</th>
  </tr>
      <tr>
      <th> Account Type</th>
      <th>Rate</th>
      <th>Length</th>
  </tr>
  <tr>
      <td>Young Saver</td>
      <td>2%</td>
      <td>1 year</td>
  </tr>
  <tr>
      <td>Smart</td>
      <td>3%</td>
      <td>2 years</td>
  </tr>
  <tr>
      <td>Long Haul</td>
      <td>4.5%</td>
      <td>4 years</td>
  </tr>
</table>

As you can see that colspan="3" combined three columns into one column. We can de same thing if we want to combine rows.

Tables  1  2  3  4  5  prev  next