作者:青大柠的小号_247 | 来源:互联网 | 2023-05-25 11:12
据我了解,flex-basis负责确定元素的大小。
在下面的示例中,我尝试将所有框的大小均等地设置为100px。仅使用flex-basis无法达到效果。
.each_box {
-webkit-flex-grow: 0;
-webkit-flex-shrink: 0;
-webkit-flex-basis: 100px;
flex-grow: 0;
flex-shrink: 0;
flex-basis: 100px;
background-color: yellow;
height: 50px;
border: 1px solid black;
}
在这里Plnkr: http
1> 小智..:
I found I had to use min-width as well as flex-basis in Chrome. I'm not sure if I had another problem that caused this.
.flex-container {
display: flex;
width: 100%;
}
.flex-child {
flex-basis: 50%;
min-width: 50%;
}