Mysterious whitespace between "inline-block" divs

Viewed 5175

I have a layout like this: Fiddle link

Between .td's is some white-space, even if margin and padding is set to 0.

Why is this happening and how to fix this? Negative margin-left maybe? Or any better solutions?

<style>
.tr {
    height: 20px;
    border: 1px solid black;
    overflow: hidden;
    white-space: nowrap;
    word-spacing: 0;
}
.td {
    display: inline-block;
    height: 20px;
    margin: 0;
    padding: 0;
}
</style>
<div class="tr" style="width: 150px;">
    <div class="td" style="width: 50px; background-color: #CCC;"></div>
    <div class="td" style="width: 50px; background-color: #AAA;"></div>
    <div class="td" style="width: 50px; background-color: #666;"></div>
</div>
6 Answers
Related