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 and can be achieved as for “cellpadding” , we can simply use padding on table cells. E.g. for 15px of “cellpadding”:
For "cellspacing", we can apply the border-spacing property to the table. E.g. for 15px of "cellspacing":
Handling IE <= 7
These CSS properties will work in almost all major browsers except for Internet Explorer basic up till Internet Explorer 7. You can use border-collapse:collapse. Only if we want 0 cellspacing and our table doesn’t have it defined already.