<style> .c { display: inline-block; background-color: #ddd; } .i { float: left; width: 200px; height: 40px; background-color: #aaa; } .i1 {background-color: #aaa;} .i2 {background-color: #bbb;} .i3 {background-color: #ccc;} </style> <div class="c"> <div class="i i1"></div> <div class="i i2"></div> <div class="i i3"></div> </div>
Where does the parent's empty space come from (from the side), when when resizing the browser window, the element with float jumps down? After all, essentially, the parent should fit snugly to the children, and not stretch to its full width, as far as I know.
How to make it fit to the children?