Sunday, January 13, 2008

Cellpadding with CSS

Padding the cells of a table used to be done using the HTML 'cellpadding' attribute. Now, the W3C has deprecated the 'cellpadding' attribute in favor of CSS.

But, as you may be aware, there isn't an equivalent property in CSS. CSS doesn't have a 'cellpadding' property. It has the 'padding' property. Only catch is, the 'padding' property only adds padding to the element that it has been applied against.

For example, if you apply padding to the 'table' element, it will pad the border around the outside of the table, but not the individual cells. Therefore, you need to apply the property in a way that will pad all cells within a table.

This is very easy to do - as long as you know how. That's why I created this article on how to apply padding to your tables using CSS.

No comments: