Sometimes, we want to set cellpadding and cellspacing in CSS.
We’ll look at how to set cellpadding and cellspacing in CSS, in this article.
How to set cellpadding and cellspacing in CSS?
To set cellpadding and cellspacing in CSS, first we have to set the padding and border properties.
For instance, we can write
td {
padding: 10px;
}
table {
border-spacing: 10px;
border-collapse: separate;
}
to add cell spacing with the border-spacing property.
border-collapse: separate;
is required to apply border-spacing
And we add cell padding with the padding property for td’s.
Conclusion
And lastly, we set the padding and border properties, to set cellpadding and cellspacing in CSS.