Cross-Browser CSS Remove Table Borders Without Cellpadding Or Cellspacing
Please note that this post is over a year old and may contain outdated information.
This very simple CSS allows you to create uniform cross-browser tables, without inserting the outdated "cellpadding" or "cellspacing" properties into your HTML. It's as simple as this:
This collapses the borders, leaving no spacing between cells. You can then add your own padding and borders with something like:
It's that simple. This works all the way back to Internet Explorer 6.
table {
border-collapse: collapse;
}
This collapses the borders, leaving no spacing between cells. You can then add your own padding and borders with something like:
tr, td {
padding: 2px 4px;
border: 1px solid #888;
}
It's that simple. This works all the way back to Internet Explorer 6.