As we know the table's cellpadding and cellspacing attributes are removed in HTML5.
But, you can still set padding inside the table cells easily using the CSS padding property. This is a valid way to produce the same effect as table's cellpadding attribute.
The style rules in the following example will add 10 pixels of padding to the table cells.
Similarly, you can use the CSS border-spacing property to apply the spacing between the adjacent table cell borders, like cellspacing attribute. However, in order to work border-spacing the value of the border-collapse property must be separate, which is default.
Let's take a look at the following example to understand how it basically works:
Use the CSS
padding&border-spacingpropertyAs we know the table's
cellpaddingandcellspacingattributes are removed in HTML5.But, you can still set padding inside the table cells easily using the CSS
paddingproperty. This is a valid way to produce the same effect as table'scellpaddingattribute.The style rules in the following example will add 10 pixels of padding to the table cells.
Similarly, you can use the CSS
border-spacingproperty to apply the spacing between the adjacent table cell borders, likecellspacingattribute. However, in order to workborder-spacingthe value of theborder-collapseproperty must beseparate, which is default.Let's take a look at the following example to understand how it basically works:
need an explanation for this answer? contact us directly to get an explanation for this answer