Thursday, 30 May 2013

Table cells that span more than one row/column: HTML

Example:

1: Column span


<table border="1">
  <tr>
    <th>Name</th>
    <th colspan="2">Contact No:</th>
  </tr>
  <tr>
    <td>Alen</td>
    <td>111 222 3333</td>
    <td>111 222 4444</td>
  </tr>
</table>
 
Output (Column span):

Name Contact No:
Alen 111 222 3333 111 222 4444

2: Row span


<table border="1">
  <tr>
    <th rowspan="2">Cell 1.1+Cell 2.1</th>
    <td>Cell 1.2</td>
    <td>Cell 1.3</td>
  </tr>
  <tr>
    <td>Cell 2.2</td>
    <td>Cell 2.3</td>
  </tr>
</table>
 
Output (Row span):

Cell 1.1+Cell 2.1 Cell 1.2 Cell 1.3
Cell 2.2 Cell 2.3

No comments:

Post a Comment