CellPadding attribute is used to control the spacing between the contents of a Cell and the Cell's border.

The above code set the space between the Cell border and the Cell content to 5 pixels.


The above picture shows an HTML Table with cellpadding=15 and another one is HTML Table with no Cellpadding.

HTML Source Code :

The Cellpadding is uniform for the entire table, individual Cellpadding in Table Cells cannot be specified. The padding amount specified is added to all four sides of the cell.

Basically, cellpadding allows for more "white space" , if you want no spaces around your text inside the Table Cell, you should set Cellpadding="0", otherwise the default is Cellpadding="1" will set , even if you don't mention Cellpadding.

The cellpadding attribute is similar to the cellspacing attribute, which is used to create space between and outside of the table cells.