In line 44 of this solution code they use a flex-grow value of 2. I have noticed that values of 1, 5, & 10 all work similarly and I am not sure why. One explanation I’ve come up with is that flex-grow: 1 is commonly used when we want all elements to be the same size, and together they should fill the container. So is that why we don’t use a value of 1 here?
And what about values larger than 2?
This is a great observation. The flex-grow property is a neat one, but can only be understood relative to what’s around it. I found that playing with the w3schools.com examples really helped me to visualize how it works. Let me know what you think.
I modified the example code to add a “ruler” with 10 blocks that are each 50px wide directly under the block of colored bars in the W3Schools example. This helps me “measure” the size of the blocks when I change the flex:grow value for the second color bar. I am not sure I fully understand it, but I am getting a better idea.