Table Attributes: <table>
| border=number | Sets the border size of the table |
| align=left/center/right | Controls the horizontal placement of text |
| cellpadding=number | Use this to set the space between table border & the contents of the table |
| cellspacing=number | Use this to set the space between individual cells of a table |
| width=number/"%" | Set the width of the table |
Row & Column Attributes: <tr><td><th>
| valign=top/middle/bottom/baseline | Vertically aligns the text |
| align=left/center/right | Controls the horizontal placement of text |
| nowrap | Switch off word wrap |
Table Data Attributes: <td><th>
| colspan=number | To set the number of columns the data cell should span |
| rowspan=number | To set the number of rows the data cell should span |
Using rowspan & colspan
Create a table thus:
<table border=1>
<tr>
<td rowspan=3>Rowspan</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td>3</td>
</tr>
</table>
|
As you can see, the first row of the table contains two data cells while the other two columns have only one. We have put the 'rowspan' value to 3 in the first data cell of the first row as there are three rows which this <td> cell should cover. The result is:
Now add to the table the following:
<table border=1>
<tr><th colspan=2>Heading</th></tr>
<tr>
<td rowspan=3>Rowspan</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td>3</td>
</tr>
</table>
|
Basically in the table which we created there were only two columns. But there is only one table header (<th>) tag. So we span it column wise giving it a value of 2 (the number of columns which this cell has to span). Previewed in browser, it looks like: