Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRory Matthews
2,287 PointsWhat is the difference between 'flex:' and 'flex-grow:'?
Hi! As in the title, really.
Also, I'm finding it difficult to understand the logic behind how flex items are being sized relative to one another with these properties.
I'm quite slow on the uptake with some of this! Any help much appreciated.
2 Answers
Rose Hurst
5,658 PointsI'm sure I'm not going to be the best at explaining this. Flex-grow is a sub-property of Flex. If you have a space with an allocated width with say 4 flex-items nested inside, if you assign flex-grow: 1; to all of them they would all share an equal amount of space. If you perhaps wanted one of those flex-items to take up a larger width of the space you would then use flex-box: 2; (one the one). The remaining flex-items would then take up equal amounts of the remaining space.
Pretty sure someone will be along that can explain this better than I did.
Chris Wiley
11,327 PointsIt looks like you are missing a element for flex-grow that should apply flex equally to each of the items in the parent. It should look something like .flexbox li { -webkit-flex-grow: 1; }
It looks like that is what you are trying to do in .column.
Your flex should then apply to the individual item you have already entered.
Also are you working in a browser that needs the webkit prefix? I had trouble early on because I'm on Firefox30 and it doesn't like the moz prefix that was tolerated in the gradients section.
Rory Matthews
2,287 PointsRory Matthews
2,287 PointsThanks Rose! I'm sorry but I still don't understand the relative sizing of items. If I have something like the following:
Why isn't column2 twice the width of the other columns? Guil says in the video it's all about ratios, so if the standard width of a column is defined here as '1', why is a column whose width is specified as '2' not twice the size of the other columns? Sorry to be slow