In this example http://jsbin.com/inoka4 no width is defined for parent element
if i want to wrap red boxes in container border.
then we can make this in 5 ways
- to giving
floatalso to<div class="container"> overflow:hiddenoroverflow:auto- any clearfix hack to
<div class="container clearfix"> - Giving height to
<div class="container"> - adding one more html element (for example another
divor<br >) after 2 boxes in<div class="container">enter code hereand giveclear:leftor:bothor:right` to that element
my question is any other option except float do not make any changes in <div class="container"> and inner boxes width. but if we use float:left or right to parent box then it's shrink the whole box and inner-boxes as well.
Why?
example link: http://jsbin.com/inoka4
Edit: My question is not about which method i should use, the question is why Float shrink the width