HTML

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

CSS

/*方法1:浮动布局实现*/
.container {
overflow: hidden;
}
.left {
float: left;
height: 100px;
background-color: red;
}
.right {
max-width: 100%;
height: 100px;
background-color: blue;
}
/*方法2:弹性布局实现*/
.container {
display: flex;
}
.left {
flex: 0 0 auto;
height: 100px;
background-color: red;
}
.right {
flex: 1 1 auto;
height: 100px;
background-color: blue;
}

相关文章:

  • 2021-08-04
  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-09
  • 2022-02-09
  • 2022-12-23
  • 2021-10-10
  • 2021-09-11
  • 2022-12-23
相关资源
相似解决方案