两列布局的多种方式

2018-05-05  本文已影响0人  lueyoo
<body>
    <div class="content">
        <div class="left">
            <p>Hello</p>
            <p>I'am left</p>
        </div>
        <div class="right">
            <p>Hi</p>
            <p>I'am right</p>
        </div>
    </div>
</body>
左边固定为200px


.left{
    background:#fcc;
    width: 200px;
    float: left;
}
.right{
    background: #f66;
    margin-left: 210px;
}
.content{
    position: relative;
    width: 100%;
    height: 500px;
    border: 1px solid #000;
}
.left{
    background:#fcc;
    width: 200px;
    position: absolute;
}
.right{
    background: #f66;
    position: absolute;
    left: 210px;
}
.content{
    width: 100%;
    height: 500px;
    border: 1px solid #000;
    display:flex;
}
.left{
    background:#fcc;
    width: 200px;
    margin-right:10px;
}
.right{
    background: #f66;
    flex:1;
}

*float+BFC

.content{
    width: 100%;
    height: 500px;
    border: 1px solid #000;
}
.left{
    background:#fcc;
    width: 200px;
    margin-right: 10px;
    float: left;
}
.right{
    background: #f66;
    overflow: hidden;
}
上一篇 下一篇

猜你喜欢

热点阅读