Resources » Code Snippets » Html

How to apply cellspacing for HTML table?


Posted Date: 26-Jul-2012  Last Updated:   Category: Html    
Author: Member Level: Gold    Points: 8


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

Attachments


Table with cellspacing and without cellspacing.

Table with cellspacing.

Table without cellspacing.


Did you like this resource? Share it with your friends and show your love!

Responses to "How to apply cellspacing for HTML table?"

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Subscribe to Subscribers
    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    Nirav Prabtani
    More...
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India