I have this HTML:
<div id="container">
    <div id="boxContainer">
        <div id="box1">
            <span>Text1</span>
        </div>
        <div id="box2">
            <span>Text2</span>
        </div>
        <div style="clear:both;"></div>
    </div>
</div>
and the following CSS:
#container {
    width:100%;
    background-color:yellow;
}
#boxContainer {
    margin: 0px auto;
    background-color:black;
}
#box1 {
    float: left;
    background-color:blue
}
#box2 {
    float: left;
    background-color:red
}
I expect the #boxContainer's width to match the sum of width of #box1 and #box2, but it is 100% and therefore it is not centered in the #container. Why?
I have this fiddle showing the issue: http://jsfiddle.net/dennismadsen/dxbfpbg1/
 
     
     
    