Super Easy Short Computer Notes To Improve Computer Literacy and Your IT Skills

Sponsored Links

Friday, January 20, 2012

Use Of Colspan and Rowspan in Tables HTML

Leave a Comment
Colspan and Rowspan are two important attributes of TD and TH tags used in HTML tables.

Colspan




Colspan is an attribute of TD or TH tags used to make data cells and header cells in an HTML table. We can use Colspan to expand / span a cell on many columns. For example, in the following table, the first header cell spans two columns, so here we use <th colspan="2">Marks</th> to get the required result in the displayed html table.

Marks
MathsComputer
10087
The complete HTML coding is as follows:

<table border="1">
<tr> <th colspan="2">Marks</th> </tr>
<tr> <th>Maths</th><th>Computer</th></tr>
<tr> <td>100</td><td>87</td> </tr>
</table>

Rowspan

Rowspan attribute is used to expand or span a cell to multiple rows. For example, in the following table example, the first TH cell (Marks) spans on two rows. We use <th rowspan="2">Marks</th> for this purpose.


Marks
MathsComputer
10087

The complete HTML coding of the table is as follows:
<table border="1">
<tr> <th rowspan="2">Marks</th>
<th>Maths</th><th>Computer</th></tr>
<tr><td>100</td><td>87</td></tr>
</table> 

0 comments:

Sponsored Links

Featured Post

Remove USB Virus Easily by Free Software SMADAV 2018 USB Antivirus

Download Smadav 2018 Free USB Antivirus and Clean your USB easily from viruses: Smadav 2018 : The Best Free Anti Virus For cleaning USB...

.