How to apply cellspacing for HTML table?
In this article i would like to explain what is cellspacing in HTML.
I also explain with an example on how to create a table with cell spacing and without cellspacing.
And also attached screen shots for different out puts.
Cellspacing :
By using cellspacing we can define space between cells in terms of pixels.
For example:
cellspacing="2"
Let us go through an example of Defining a table without cellspacing,with cellspacing :
Defining a table without cellspacing:
<table border="2" width="50%">
<tr style="font-weight:bold;">
<td>Employee Name</td>
<td>Salary</td>
</tr>
<tr>
<td>Kumar</td>
<td>10000/-</td>
</tr>
<tr>
<td>Guru</td>
<td>30000/-</td>
</tr>
<tr>
<td>Praveen</td>
<td>20000/-</td>
</tr>
</table>
Defining a table with cellspacing:
<table border="2" width="50%" cellspacing="8">
<tr style="font-weight:bold;">
<td>Employee Name</td>
<td>Salary</td>
</tr>
<tr>
<td>Kumar</td>
<td>10000/-</td>
</tr>
<tr>
<td>Guru</td>
<td>30000/-</td>
</tr>
<tr>
<td>Praveen</td>
<td>20000/-</td>
</tr>
</table>
Thanks & Regards
Guruvu Setty