Computer >> Computer tutorials >  >> Programming >> HTML

Difference Between Cellpadding and Cellspacing


In this post, we will understand the difference between cellpadding and cell spacing.

Cellpadding

  • It is associated with a single cell.

  • It helps control the white space that is present between the border of the cell and the contents within the cell.

  • The default value of cell padding is 1.

  • It is used as an effective method.

  • It is created using HTML <table> tag.

  • The type of attribute is set to ‘cellpadding’.

Example

<table cellpadding="value" >.....</table>

Cellspacing

  • It is associated with more than a single cell.

  • It helps set the space between the single cells.

  • It is less effective than cell padding.

  • The default cell spacing value is 2.

  • It can be created using HTML <table> tag.

  • The type of attribute is set to ‘cellspacing’.

Example

<table cellspacing="value" >.....</table>

Output

Difference Between Cellpadding and Cellspacing