面试题9 写出实现效果所需的CSS代码
实现以下效果,一个class为f的DIV中包含4个子DIV。父DIV的宽460px,高100px,子DIV宽高都为100px,子DIV之间的间距为20px,4个子DIV只能有一个class名。写出实现效果所需的代码。
【提示】
HTML部分为:
<div class="f">
<div></div>
<div></div>
<div></div>
<div class="f_sp"></div>
</div>
CSS部分为:
.f{width:460px;height:100px;background-color:#000;}
.f div{width:100px;height:100px;background-color:#ccc;float:left;margin:0 20px 0 0;}
.f.f_sp{margin:0;}