左边宽度固定右边宽度填满剩余
flex 是 flex-grow、flex-shrink、flex-basis的缩写。
flex-grow属性定义项目的放大比例,默认为0,即如果存在剩余空间,也不放大。
flex-shrink属性定义了项目的缩小比例,默认为1,即如果空间不足,该项目将缩小。
flex-basis属性定义了在分配多余空间之前,项目占据的主轴空间(main size)。浏览器根据这个属性,计算主轴是否有多余空间。它的默认值为auto,即项目的本来大小。
/方法2:弹性布局实现/
.container {
display: flex;
}
.left {
flex: 0 0 auto;
height: 100px;
background-color: red;
}
.right {
flex: 1 1 auto;
height: 100px;
background-color: blue;
}
flex详情
Last modification:December 4th, 2020 at 09:40 am
© The copyright belongs to the author