css页面布局

1、左侧固定宽高,右侧自适应占满

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

style样式

*{
   margin:0;
   padding:0;

}
.box{
        height:500px;
        background:yellow;
}
.left{
       float:left;
       width:200px;
       height:100%;
       background:red;

}
.right{
       width-left:200px;
       height:100%;
       background:green;

}

2、左右固定宽高,中间自适应占满

<div class="box">
              <div class="left"></div>
              <div class="right"></div>
              <div class="center"></div>
</div>

style样式

*{
   margin:0;
   padding:0;

}
.box{
        height:500px;
        background:yellow;
}
.left{
       float:left;
       width:200px;
       height:100%;
       background:red;

}
*{
   margin:0;
   padding:0;

}
.box{
        height:500px;
        background:yellow;
}
.left{
       float:left;
       width:200px;
       height:100%;
       background:red;
}
.center{
       height:500px:
       background:blue;
}

.right{
       width:200px;
       height:100%;
       float:right;
       background:green;

}

 

posted @ 2018-12-19 22:18  我想静静i  阅读(100)  评论(0编辑  收藏  举报