What Is Difference Between Cellpading And Cellspacing In HTML?

4

4 Answers

Zachary Craft Profile
Zachary Craft answered
In HTML, the table tag has two properties, cellspacing and cellpadding. Cellspacing controls the space between table cells by defining the pixel width between them (controls the thickness of the border in other words). Cellpadding controls the amount of space between the contents of the cell (text, images, etc) from the cell wall (border). The default for both properties is zero.

Here are some samples:

< table border="1" >
< tr >
< td >some text< /td >
< td >some text< /td >
< /tr >< tr >
< td >some text< /td >
< td >some text< /td >
< /tr >
< /table >

What it looks like:
i157.photobucket.com

< table border="1" cellspacing="5" >
< tr >
< td >some text< /td >
< td >some text< /td >
< /tr >< tr >
< td >some text< /td >
< td >some text< /td >
< /tr >
< /table >

What it looks like:
i157.photobucket.com

< table border="1" cellpadding="10" >
< tr >
< td >some text< /td >
< td >some text< /td >
< /tr >< tr >
< td >some text< /td >
< td >some text< /td >
< /tr >
< /table >

What it looks like:
i157.photobucket.com
Khalid Hussain Profile
Khalid Hussain answered
The cellspacing attribute adjusts the space between the cells and cellpadding adjust the space within the cells.
Rakesh Divekar Profile
Rakesh Divekar answered
Cell padding= Distance in pixel between the cell border and its content.cell spacing= Distance in pixel between the two Respected cells.
Anonymous Profile
Anonymous answered
Cellpading is the distance between cell and text in the cell and cell spacing is the distance between two cells.

Answer Question

Anonymous