Here is my html code looks alike.
<div style="width:70%; margin:0px auto; border:1px solid #000;">
<div style="float:left; width:100px; border:1px solid #000;">Test</div>
<div style="float:left; border:1px solid #000;">Test</div>
</div>
The output result looks like this.
As you can see, the wrapper div is at the center of the browser but two of the inner div are on the left side. I want them to be in the center of the wrapper div.
Any ways to do it ? Please help me out. Thanks.
display: inline-blockcan do this in a reasonably simple way:See: http://jsfiddle.net/LJaDd/
divaround your inner twodivs, and gave itdisplay: inline-block.text-align: centerto the outerdivto center the wrapperdiv, then addedtext-align: leftto the wrapperdivto align the text inside back to the left.overflow: hiddento the outerdivso that it contains the floateddivs.