flex-grow: Whether to zoom in when the parent control has space left, where the value represents the zoom ratio, and a value of 0 means no zoom;
flex-shrink: When the parent control space is not enough, whether to shrink (shrink), where the value represents the reduction ratio, when the value is 0, it means not to shrink;
- When the flex-basis and width attributes exist at the same time, the width attribute does not take effect, and the width of the flex item is the width set by flex-basis;
- Application guidelines for the width of flex items: flex-basis (subject to max | min-width) priority is greater than width priority is greater than content;
-
.flex-item{ flex -basis: 300px; // failure max- width: 100px; } .item1{ background: #66efab; }
Solution: 3 child views set a parent view, the parent view sets a min-height: 100%; display: flex; flex-direction: column ;, the middle view sets flex: 1;
flex is the abbreviation of flex-grow, flex-shrink, flex-basis
The default property of flex is 0 1 auto, [the parent control has no remaining controls to enlarge, the parent control space is not enough, press 1 to reduce, to maintain its own space size];
The value of flex: 1; is 1 1 0%, [the parent control has the remaining space to account for 1 enlargement, the parent control space is insufficient to press 1 to reduce, its own space size is 0%];
Original: https://www.douban.com/note/717223803/