美文网首页
三列布局(两列定宽,一列自适应)

三列布局(两列定宽,一列自适应)

作者: 蜗牛和曼巴 | 来源:发表于2019-10-17 15:21 被阅读0次
方法一:float+overflow
  <div class="box">
    <div class="class1">1</div>
    <div class="class2">2</div>
    <div class="class3">3</div>
  </div>
<style>
  .class1{
    width: 100px;
    height: 400px;
    background: red;
    float: left;
  }
  .class2{
    width: 100px;
    height: 400px;
    background: rgb(25, 0, 255);
    float: left;
  }
  .class3{
    height: 400px;
    background: rgb(233, 199, 10);
    overflow: hidden;
  }
</style>
方法二:flex
  <div class="box">
    <div class="class1">1</div>
    <div class="class2">2</div>
    <div class="class3">3</div>
  </div>
<style>
  .box{
    display: flex;
  }
  .class1{
    width: 100px;
    height: 400px;
    background: red;
  }
  .class2{
    width: 100px;
    height: 400px;
    background: rgb(25, 0, 255);
  }
  .class3{
    height: 400px;
    background: rgb(233, 199, 10);
    flex: 1
  }
</style>

相关文章

网友评论

      本文标题:三列布局(两列定宽,一列自适应)

      本文链接:https://www.haomeiwen.com/subject/ejtvmctx.html