如果要实现2列固定宽度,以及居中。
摘自狂人:浮动(float)是css布局中的非常强大的布局功能,也是理解css的关系问题所在,css中,包括div中的任何元素都可以以浮动的方式进行。看2行代码:
<div style="width: 50%; height: 100px; margin: 100px auto; background: red;">
        </div>
        <div style="width: 40%; height: 100px; margin: 100px auto; background: green;">
        </div>


如何将这2个div并列在一起呢?只要设置2个div的浮动为向左浮动就可以了。
<div style="width: 50%; height: 100px; margin: 100px auto; background: red;float:left;">
        </div>
        <div style="width: 40%; height: 100px; margin: 100px auto; background: green;float:left;">
        </div>