html+css 两栏布局

90 阅读1分钟

绝对定位 实现两栏布局

#box{
      position: relative;
      width: 500px;
      height: 600px;
      margin: auto;
      text-align: center;
    }
.left,.right{
      position: absolute;
      height: 600px;
    }
.left{
     width: 30%;
     background-color: aquamarine;
   }
.right{
     width: 70%;
     left: 30%;
     background-color: blue;
   }
 <div id="box">
    <div class="left">left</div>
    <div class="right">right</div>
 </div>