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-spacing
propertyAs we know the table's
cellpadding
andcellspacing
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'scellpadding
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, likecellspacing
attribute. However, in order to workborder-spacing
the value of theborder-collapse
property 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