If I create a container div and then some child div elements (say three) and set the parent to display: inline-block, I get something like this jsfiddle-good

CSS
#container {
border: 1px solid blue;
padding: 2px;
display: inline-block;
}
.child {
width: 100px;
border: 1px solid black;
float: left;
margin: 2px;
}
HTML
<div id="container">
<div class="child">child 1</div>
<div class="child">child 2</div>
<div class="child">child 3</div>
</div>
It's good! I want to. The problem occurs when I have many children (say 30) jsfiddle-bad

Why is it a white spear space, and how do I get the div container to size down correctly?
source
share