How to set table cellpadding and cellspacing in CSS
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
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