The W3C working draft on October 08, 2015 for HTML 5.1 lists both cellspacing and cellpadding on table elements as deprecated and should therefore be avoided.
In Section 11.2 Inappropriate Functions, you will find the following note:
The items in the following list are completely outdated and should not be used by the authors.
When adding cellpadding and cellspacing to the list
- cellpadding on table elements
- cellpacing on table elements
So, here are your options;
Option 1
You can add the following styles to the current style sheet:
table { background-color: blue; border-collapse: collapse; border-spacing: 0; /* cellspacing */ } th, td { padding: 0px; /* cellpadding */ }
This solution will look something like this: https://jsfiddle.net/z9tz4Lcb/
Option 2
Normalize your CSS mentioned by Vucko in the comments.
You either download or link the normalize.css file directly to GitHub or use some kind of CDN as shown below
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.min.css">
This solution will look something like this: https://jsfiddle.net/x7a6kjvo/
.. and while you are on it
You must also set display: block; in the page style sheet for your <img> tag to remove the small space below your image.
You can also use line-height: 0; in your image container or set vertical-align: bottom; into your img tag. I also see people suggesting using vertical-align: sub; but this will not work in IE6 or IE7.
td > img { display: block; }
Rune Vikestad
source share