开发者社区 问答 正文

两列布局两种方法实现

screenshot
第一种方法是外边距+固定宽度+浮动
还有什么方法?越多越好,谢谢。

展开
收起
a123456678 2016-05-27 11:30:21 1754 分享 版权
1 条回答
写回答
取消 提交回答
  • <style>
            .box1{
                width: 200px;
                height: 100px;
                float: left;
                background: blue;
                margin-left: -100%;
            }
            .box2{
                width: 100%;
                float: left;
                height: 100px;
                background: red;
            }
            .box3{
                width: 100%;
                height: 100px;
                background: yellow;
                float: left;
            }
            .box2_wrap{
                margin-left: 200px;
            }
        </style>
    <div id="container">
            <div class="box2">
                <div class="box2_wrap">box2</div>
            </div>
            <div class="box1">box1</div>
            <div class="box3">box3</div>
        </div>
    2019-07-17 19:17:31
    赞同 展开评论
问答地址: