关于float的一些问题

如下图的效果如何实现:

图片描述

#div4{
    width: 180px;
    height: 60px;
}

<div class="wrap" id="div4">

            <div id="div1">容器1;</div>
            <div id="div2">容器2;</div>
            <div id="div3">容器3;</div>
            <p>效果3</p>
        </div>
阅读 1.8k
2 个回答

<div style="width:180px;height:60px;position:relative;border:1px solid #000">
<div style="width:90px;height:30px;float:left;background:#F00;">1
</div>
<div style="width:90px;height:30px;clear:both;float:left;background:#00F;">2
</div>
<div style="width:90px;height:30px;float:left;margin-top:-30px;background:#0F0;">3
</div>
<p style="clear:both;text-align:center;">效果3</p>
</div>

div1,#div2,#div3{width:90px;float:left;}

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题