常用css上下布局-上边高度固定,下边高度自适应

 上下两个盒子,上边的固定,下面的自适应

<div class= "container">
    <div class="left"></div>
    <div class="right"></div>
</div>
 
<style>
.container{
    position: relative;
	width: 200px;
	height: 600px;
	border: 1px solid red;
}
.left{
    width:100%;
    height:200px;
	background: blue;
}
.right{
    position: absolute;
    width: 100%;
    top: 200px;
    bottom: 0;
	left: 0;
    background: yellow;
}
</style>

猜你喜欢

转载自blog.csdn.net/qq_42221334/article/details/83898443