Cross-Browser CSS Remove Table Borders Without Cellpadding Or Cellspacing

Jul 8, 2014   Web Development   Nick Vogt   Comments
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:

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.
Share This Post

Comments (0)

Share This Post
H3XED © Nick Vogt   RSS   Policies   Twitter