There are two solutions that I came up with. Use solution 2 , but I keep solution 1 here, because it might come in handy in some other situation to someone else.
Solution 1: Display
Changing the td display to inline-block does the trick, but may affect your actual content elsewhere ...
td { display: inline-block; border-radius: 5px; background-color: #369; color: white; border: 5px solid white; }
Here's the modified JSFiddle for solution 1.
Solution 2: Background clip (recommended)
But since you're using CSS3 anyway, this is an even better solution:
td { background-clip: padding-box; border-radius: 5px; background-color: #369; color: white; border: 5px solid white; }
Here's the modified JSFiddle for solution 2.
If it does not work in all browsers, you should know that there are specific browser settings, such as -moz-background-clip and -webkit-background-clip , which use a different set of values (they basically skip the field from the border-box , padding-box and content-box )
source share