Reputation: 13046
I was following this example of responsive tables : http://dbushell.com/demos/tables/rt_05-01-12.html
but I have a weird space between table rows displayed as inline-block, here's a demo: http://codepen.io/anon/pen/Fksjw
I tried zeroing out the margins but I can't get rid of this space.
Upvotes: 3
Views: 8520
Reputation: 1
The Inline-block elements always give 3 pixels of extra margin. You can solve it subtracting 3 pixel for each horizontal side:
tbody tr {
display: inline-block;
margin: 0 -3px;
vertical-align: middle;
}
Upvotes: 0
Reputation: 193281
What you see is the default behaviour of inline (inline-block) elements. One possible solution is to set font-size
and line-height
to 0 to make white spaces invisible. Then you just reset them back to some values:
tbody {
...
line-height: 0;
font-size: 0;
}
tbody td {
...
line-height: 20px;
font-size: 14px;
}
Another solution would be manually remove all the line breaks and spaces between tr
.
Upvotes: 6
Reputation: 9065
Add this to your css:
table {
border-collapse: collapse;
}
tbody tr {
display: table-row;
}
tbody td {
display: table-cell;
}
Upvotes: 1