怎样让一个大DIV里的四个小DIV上下左右分布?

<div class="ppss">

<h2>真心话</h2>
<div class="xinzeng1">A</div>
<div class="xinzeng2">B</div>
<div class="xinzeng3">C</div>
<div class="xinzeng4">D</div>
</div>

四个小DIV就像图片这样显示就行,谢了!!高手赐教!!

<style>
.ppss{width:500px;height:520px;}
.ppss h2{padding:0;margin:0;height:20px;width:500px;}
.xinzeng1,.xinzeng2,.xinzeng3,.xinzeng4{width:250px;height:250px;float:left;color:#fff;}
.xinzeng1{background:#f00;}
.xinzeng2{background:#0f0;}
.xinzeng3{background:#00f;}
.xinzeng4{background:#000;}
<div class="ppss"> 
<h2>真心话</h2>
<div class="xinzeng1">A</div>
<div class="xinzeng2">B</div>
<div class="xinzeng3">C</div>
<div class="xinzeng4">D</div>
<div style="clear:both;"></div>
</div>

 里面四个DIV都设置浮云就可以了,注意容器宽度和里面DIV的总宽度就可以了。

温馨提示:内容为网友见解,仅供参考
第1个回答  2014-04-15

试试吧           

第2个回答  2014-04-15
<html>
<head>
<style>
.mgl10{ margin-left:10px;}
.cbRed{background-color:#F00;}
.cbGreen{background-color:#0F0;}
.cbGreen2{background-color:#DAF17E;}
.cbBlue{background-color: #00F;}
.divpan{ width:50px; height:30px; float:left; text-align:center; line-height:30px; font-size:14px; margin-top:10px;}
ul li{ margin:0; padding:0; list-style:none; clear:both;}
</style>
</head>
<body>
<ul>
<li><div class="divpan cbRed">A</div><div class="divpan mgl10 cbGreen">B</div></li>
<li><div class="divpan cbGreen2">C</div><div class="divpan mgl10 cbBlue">D</div></li>
</ul>
</body>
</html>
相似回答