Cell Padding and Cell Spacing in HTML
I am a bit getting confused between these two attributes of HTML - tcell padding and cell spacing. Both are table attributes but I am totally confused which one means what ? Can anyone explain in simple language what each of these table attributes mean ?
Re: Cell Padding and Cell Spacing in HTML
Yes, both the definitions seems to be similar but they are diffrent.
The cellpadding attribute specifies the space between the cell wall and the cell content.
The cellspacing attribute specifies the space between cells.
Re: Cell Padding and Cell Spacing in HTML
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.
Example of a Cell Spacing -
< 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 >
It gives the following result -
http://gallery.techarena.in/data/516/cellspacing.gif
Example of a Cell Padding -
< 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 >
It gives the following result -
http://gallery.techarena.in/data/516/cellpadding.gif
Re: Cell Padding and Cell Spacing in HTML
The cellspacing attribute adjusts the space between the cells (intercell attribute) and cellpadding adjust the space within the cells(intracell attribute).