What is the purpose of defining width:0 when there is flex:1?

as the title

div{
    flex:1;
    width:0;
}
What is the role of width:0 in

?

Mar.12,2021

if width, is not set, when the content size of the internal element exceeds the average allocated remaining space, the width of the element is equal to the content size, if width is set and the size of the width is less than the average allocated remaining space, the average allocated remaining space is taken.
when flex is set to 1, it is equivalent to the size of the remaining space = the width of the parent element, so the average size of the remaining space
is equal to the width of the parent element / the number of elements
directly setting width to 0 ensures that the width of the element is evenly divided into the width of the parent element


when the contents of the two elastic boxes are not the same height, the element width of the flex will have an unexpected proportional effect. Add the width attribute (any value) to achieve the desired scale effect

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e49104-437df.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e49104-437df.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?