Difference between Cellpadding and Cellspacing

SHARE

What is Cellpadding?

Cellpadding is a term used in the computer language (HTML) Hypertext Markup Language. The cellpadding attribute was added to version 2.0 of the HTML language in 1996. When used in conjunction with the table element, it specifies the amount of space between the border of a table cell and its contents. Cellpadding is an attribute of an individual cell in a table, so each cell in a table can have its own cellpadding value.

Space between text and borders is an important element of web page design, because it improves the readability of text and visual appeal of graphics in table cells. Cellpadding makes this possible, and web design experts emphasize the importance of carefully selecting the cellpadding values.

What is Cellspacing?

Cellspacing specifies the space between cells i.e it defines the whitespace between the edges of the adjacent cells. In other words, it controls the distance between single cells in a table. By using this attribute, designers could easily alter the space between the edges of the different adjacent cells. It improves the clarity of the table. The increase in the quantity of cellspacing apparently increases the cell border, which will be shown in the example.

Cellspacing is mainly used in web designing. Different languages have quite a different syntax for the cellspacing such as in CSS it is employed using “border-spacing” property while in HTML “cellspacing” is used.

Cellpadding vs Cellspacing

BASIS OF COMPARISON CELLPADDING CELLSPACING
Description Cellpadding specifies the space between the border of a table cell and its contents i.e it defines the whitespace between the cell edge and the content of the cell. Cellspacing specifies the space between cells i.e it defines the whitespace between the edges of the adjacent cells.
Alternative Definition Cellpadding is the space between the content inside the box and its borders. Cellspacing is the space between boxes.
Creation It is created by using HTML <table> tag but type attribute is set to cellpadding. It is created by using HTML <table> tag but type attribute is set to cellspacing.
Default Value The default value for cellpadding is 1. The default value for cellspacing is 2.
Use It is mainly meant for a single cell. Cellspacing can get subjected to more than one cell.
Effectiveness Cellpadding is widely used and is considered to be more effective than Cellspacing. Cellspacing is less effective than Cellpadding.

Conclusion

Tables without adequate spacing in or around cells are difficult to read. The cell padding attribute places spacing around data within each cell. The cell spacing attribute places space around each cell in the table.