div中宽度auto不起作用

<div class="div1" style="width:100%; height:60px;">
<div class="div2" style="width:auto; height:100%; margin:0 auto;">111111111</div>
</div>
我想div2居中于div1,但为什么div2中,width:auto不起作用?搞了一晚上...

第1个回答  2015-08-24
<div class="div1" style="width:900px; height:60px;">
    <div class="div2" style=" height:100%; margin:0 auto;">111111111</div>
</div>

本回答被网友采纳
相似回答