Development – Leet 4 Life

Software Development Code Samples and More

Skip to: Content | Sidebar | Footer

HTML5 Table Borders Using CSS

14 November, 2012 | CSS, HTML5 | By: Michael Adams

I’m working on a HTML5 website and need a way to have borders on the TD tags without using the cellpadding and cellspacing attributes like I usually implement since they have been deprecated. After some googling I found a solution here. The answer does not mention HTML5 specifically but it worked like a charm.

 border-spacing: 0px;
 border-collapse: collapse;

The above CSS will remove all spacing from a table completely and will do so for all tables on a page or any page that implement this CSS. The border-collapse: collapse attribute is added solely to collapse borders for for Internet Explorer versions 5-7. If you are just looking to go for current browsers or are looking to increase the size of the border then you can omit that line.

If you want to see more of what is supported by different browsers for CSS and Tables you can go here.

Original code posted here.

Write a comment