Sometimes, we want to set cell padding and cell spacing in CSS.
In this article, we’ll look at how to set cell padding and cell spacing in CSS.
How to set cell padding and cell spacing in CSS?
To set cell padding and cell spacing in CSS, we can set the border-spacing
and border-collapse
, padding
CSS properties.
For instance, we write
td {
padding: 10px;
}
table {
border-spacing: 10px;
border-collapse: separate;
}
to set the padding of the cells with
td {
padding: 10px;
}
Then we set the border-spacing
CSS property to set the cell spacing.
border-collapse
is set to separate
so the borders of the cells have spacing.
Conclusion
To set cell padding and cell spacing in CSS, we can set the border-spacing
and border-collapse
, padding
CSS properties.