Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Space between <td>. Why and how can I remove?

Tags:

html

css

styles

I create "normal" table and all TD's have "border: 1px solid #e6e6e6" and "margin: 0". TR and TABLE have too "margin/padding: 0" but I still have space between TDs like here: h

enter image description here

Why? :)

<td></td> 

http://jsfiddle.net/VfSdV/

like image 824
Kuba Żukowski Avatar asked Jul 24 '13 14:07

Kuba Żukowski


People also ask

How do I get rid of space between two TD?

The space between the table cells is controlled by the CELLSPACING attribute in the TABLE tag. By setting CELLSPACING to zero, you can remove all the space between the cells of your table.

How do I remove spaces from a table?

HTML tables are comprised of rows and cells. In traditional HTML coding you remove the spacing within a cell by setting the “cellspacing” attribute to zero.

How do I remove border spacing in a table?

This is a Default behavior of the table cells that there is some space between their Borders. To remove this space we can use the CSS border-collapsing Property. This Property is used to set the borders of the cell present inside the table and tells whether these cells will share a common border or not.


1 Answers

Since cellspacing and cellpadding are no longer supported in HTML5, use the following CSS:

table {   border-collapse: collapse; } 

jsfiddle

like image 184
Brian Phillips Avatar answered Oct 11 '22 10:10

Brian Phillips