You can easily set padding inside the table cells using the CSS padding property. It is a valid way to produce the same effect as the table's cellpadding attribute.
table,
th,
td {
border: 1px solid #666;
}
table th,
table td {
padding: 10px;
/* Apply cell padding */
}
Set Cellpadding in CSSRowFirst NameLast NameEmail
1ClarkKentclarkkent@mail.com2PeterParkerpeterparker@mail.com3JohnRambojohnrambo@mail.comSimilarly, you can use the CSS border-spacing property to apply the spacing between adjacent table cell borders like the cellspacing attribute. However, in order to work border-spacing the value of border-collapse property muse be separate, which is default.
table {
border-collapse: separate;
border-spacing: 10px;
/* Apply cell spacing */
}
table,
th,
td {
border: 1px solid #666;
}
table th,
table td {
padding: 5px;
/* Apply cell padding */
}
Set Cellspacing in CSSRowFirst NameLast NameEmail
1ClarkKentclarkkent@mail.com2PeterParkerpeterparker@mail.com3JohnRambojohnrambo@mail.com