布局 —— 左侧固定,右侧自适应

实现布局:左侧固定,右侧自适应css

一. flex布局html

html:布局

<div class="content">
    <div class="left"></div>
    <div class="right"></div>
</div>

 

css:flex

.content {
    width: 100%;
    display: flex;
}
.left {
    width: 200px;
    height: 500px;
    background: #e1e1e1;
}
.right {
    flex: 1;
    height: 500px;
    background: #666;
}

二. spa

html同上code

css:htm

.content {
    width: 100%;
}
.left {
    width: 200px;
    height: 500px;
    background: #e1e1e1;
    float: left;
}
.right {
    height: 500px;
    background: #666;
}

 

三. 相似圣杯布局blog

html同上class

css:float

.content {
    padding-left: 200px;
}
.left {
    width: 200px;
    height: 500px;
    background: #e1e1e1;
    float: left;
    margin-left: -200px;
    }
.right {
    width: 100%;
    height: 500px;
    background: #666;
}

 

四. 相似双飞翼布局

html:

<div class="main">
    <div class="right"></div>
</div>
<div class="left"></div>

css:

.main {
    float: left;
    width: 100%;
}
.right {
    height: 500px;
    background: #666;
    margin-left: 200px;
}
.left {
    width: 200px;
    height: 500px;
    background: #e1e1e1;
    float: left;
    margin-left: -100%;
}
相关文章
相关标签/搜索