You can set the cellpadding and cell spacing properties for a table in CSS using the border-collapse property and the border-spacing property, respectively.

The border-collapse property sets the border model for a table. The separate value creates a separated-border model, where each cell has its own distinct borders.

The border-spacing property sets the distance between the borders of adjacent cells in a table. The property takes two values, the first value is the horizontal spacing, and the second value is the vertical spacing. 

In the example below, the horizontal spacing is set to 10px and the vertical spacing is set to 5px.

For controlling "cellpadding" in CSS, just write the simple code for padding on table cells. E.g. for 10px of "cellpadding":


td { 
    padding: 10px;
}


For "cellspacing", just write the simple code for border-spacing CSS property to your table. E.g. for 10px and 5px of "cellspacing":


table { 
    border-spacing: 10px 5px;
    border-collapse: separate;
}