Home Set cellpadding and cellspacing in CSS?

# Set cellpadding and cellspacing in CSS?

user6824
1#
user6824 Published in September 19, 2018, 11:45 am

In an HTML table, the cellpadding and cellspacing can be set like this:

<table cellspacing="1" cellpadding="1">


How can the same be accomplished using CSS?

• Just a general suggestion, check to see if your style.css does a "reset" on your tables before trying these solutions. Example: If you don't have tables set to width:auto then border-collapse might not work as expected. – PJ Brunet Sep 1 '16 at 7:12
• Use border-spacing on table and padding on td. – Anubhav May 23 '17 at 9:17