Tuesday, September 11, 2007

HTML Colspan And Rowspan on the table


Colspan indicate how many columns of cell should be take up to span together.
Rowspan indicate how many rows of cell should be take up to span together.

For example we want to build the list of employer in the table. In head cell have coloumn Name and Region. Below the Region colounm header have a two coloumn, that is a City and Post Code. For more understanding what i meands, look the example table in below.

Now let's see the code in here :

<table border="1">
<tr>
<td rowspan="2">Name</td>
<td colspan="2">Region</td>
</tr>
<tr>
<td>City</td>
<td>Post Code</td>
</tr>
<tr>
<td>Innan Mei S</td>
<td>Tegal</td>
<td>52123</td>
</tr>
<tr>
<td>Jimy John</td>
<td>Semarang</td>
<td>7586</td>
</tr>
<tr>
<td>Arde Sany</td>
<td>Jakarta</td>
<td>58985</td>
</tr>
</table>


The value of attribute colspan or rowspan is integer like in the example (Rowspan = 2 or colspan = 2), its means cell many row that you want span.
You can use the attribut cellpadding or bgcolor to make the table more beauty.

0 Comments:

Post a Comment

<< Home