One, the use of the flex layout when the pit:
1, the common distribution of the flex layout, left a given width, the right to fill the remaining space, but when the right side of the text content, will be crowding the left space, the left can not be displayed in accordance with a fixed width.
<style>. Father{Display:Flex;width:500px;Height:200px; }. Left{width:200px;Background-color:Green; }. Right{Flex-grow:1;Background-color:Red; } </style> <Body> <Divclass= "Father"> <Divclass= "Left">Left left and left left side</Div> <Divclass= "Right">Right</Div> </Div> </Body>
The correct width is displayed as follows:
However, when the text in the right red box changes:
Obviously when the right text increases, the left side is compressed when the remaining space is squeezed, and the workaround is as follows:
1) Add width to the right "width:0;", specify width 0
. right{ flex-grow:1; background-color:red; }
2) Add Flex-basis property to the element that has the Flex-grow property set
. right{ flex-grow:1; background-color:red; flex-basis:0%; }
2. The difference between basis and width in flex layout, reference link HTTPS://WWW.JIANSHU.COM/P/17B1B445ECD4
CSS properties apply a hodgepodge of bugs (follow up to update)