According to What are the differences between flex-basis and width?, flex-shrink is default to 1, which means a flex item's size might be changed.
Now I have a flex container with two children div.
The first one is with 'flex-basis: 200px;', this second one is with 'flex-basis: 100%;'
When I resize the container, the width for the first div is shrank.
<div class="flex-container">
<div class="flex-item-1">div1</div>
<div class="flex-item-2">div2</div>
</div>
.flex-container {
display: flex;
}
.flex-item-1 {
background: red;
flex-basis: 200px;
}
.flex-item-2 {
background: green;
flex-basis: 100%;
}
Why the width of first one is changed since the second one is using a percentage value? I think browser should shrink the second one.
The question here is: what will happen if all flex items have either fixed width or percentage width, and sum of all fixed width is less than width of flex container?