建站常识

DIV+CSS 左侧固定,右侧自适应代码

发布时间 | 2017/1/7  点击 | 

上海网页制作介绍了左侧固定,右侧自适应的两种实现方法,相信对大家学习网页布局会有很好的帮助,下面就跟小编一起来看下吧

第一种方法:

<style>
.one {
position: absolute;
height: 200px;
width: 300px;
background-color: blue;
}
.two {
height: 200px;
margin-left: 300px;
background-color: red;
}
</style>
<div class="one">左边</div>
<div class="two">右边</div>
第二种方法:
<style>
.one {
float:left;
height: 200px;
width: 300px;
background-color: blue;
}
.two {
overflow: auto;
height: 200px;
background-color: red;
}
</style>

<div class="one">左边</div>
<div class="two">右边</div>

相关信息