两栏布局

Liinboc / 2023-07-31 / 原文

左边固定右边宽度自适应

固定元素要显式设置width,height

自适应元素要显式设置height

自适应可以通过设置相对单位来完成,如 % , flex:1等

    <div class="left"></div>
    <div class="right"></div>
.left{
    height:200px;
    width:300px;
    background-color: red;
    float: left;
}
.right{
    height: 200px;
    /* width:100%; */
    background-color: green;
}