Let's see this piece of code :)
HTML
<div class="mid">
test inline-block
</div>
<div class="mid">
test inline-block
</div>
<div class="floated">
test block floated
</div>
<div class="floated">
test block floated
</div>
CSS
.mid {
display: inline-block;
margin: 0;
padding: 1em;
box-sizing: border-box;
width: 47.5%;
background: red;
}
.mid + .mid {
margin-left: 4%;
}
.floated {
float: left;
display: block;
background: green;
margin: 0;
padding: 1em;
box-sizing: border-box;
width: 47.5%;
}
.floated + .floated {
margin-left: 5%;
}
You can also see the fiddle for testing purpose : http://jsfiddle.net/LdDSJ/
Now my question : on normal size, both inline-block and floated block are side-by-side, it's ok. But note they are not equal in width.
Try to resize the window : the inline-block elements breaks, one going below the other. By the way, I had to put a lower margin-left to that element because it would have break.
I know there's some whitespace around there, so my question is : is it viable to put layout elements display: inline-block instead of display:block + float property ? As all solution provided (How to remove the space between inline-block elements?) seems hacky (font-size:0, using comments, ...) ?
inline-block
elements have spaces in between them. See: css-tricks.com/fighting-the-space-between-inline-block-elements – Moob