<div style="float:left">图像1</div>
<div style="float:left">图像2</div>
<div style="float:left">图像3</div>
</div>
让div_1下面的图像居中,我想的办法是在div_1的外面再加一个div,然后让div_1居中
<div class="div_out">
<div class="div_1">
<div style="float:left">图像1</div>
<div style="float:left">图像2</div>
<div style="float:left">图像3</div>
</div>
</div>
.div_out{text-align:center;}
但是,如果图像数量不固定 那么div_1的宽度要随着图像div的数量而决定 也就无法使用这种方法了。。。
有除了js以外的方法吗?