CSS

Quick Tip: How to apply Cellpadding and Cellspacing in CSS

In HTML, we have seen the table styles cellpadding and cellspacing can be set as . But how would this be accomplished using cascading style sheet? The way of doing this is very simple…

In HTML, we have seen the table styles cellpadding and cellspacing can be set as

. But how would this be accomplished using cascading style sheet?

The way of doing this is very simple and can be achieved as for “cellpadding” , we can simply use padding on table cells. E.g. for 15px of “cellpadding”:

td { 
    padding: 15px;
}


For "cellspacing", we can apply the border-spacing property to the table. E.g. for 15px of "cellspacing":

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

Handling IE