Monthly Archives: April 2014

CSS to replace cellpadding and cellspacing

I was having trouble properly formatting a table in html with css and I found this on Stack Overflow.

Replace cellpadding with:

th, td { padding: 5px; }

Replace cellspacing with:

table { border-collapse: separate; border-spacing: 5px; } // cellspacing=”5″
table { border-collapse: collapse; border-spacing: 0; } // cellspacing=”0″

Replace valign with:
th, td { vertical-align: top; }

Replace align (center) with:
table { margin: 0 auto; }

The original article is here.