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 trial
Lady Do While
6,027 PointsFlex Shorthand
I understand flex-grow:: it allows a flex item to grow based on a ratio relative to the other flex items on the same row/column.
I understand flex-shrink:: it allows a flex item to shrink based on a ratio relative to the other flex items on the same row/column.
I understand flex-basis: it overrules the main-size value and sets it's width (or height, depending on orientation).
HOWEVER, I don't understand auto and 0 and the like. If you look at this example, I expected that all three boxes would be the same size, since they all are "allowed" to grow. And it's not because box 1 is set to be so large that the others have shrunk, because it's rendered width is much more than the flex-basis of 100px...
This makes no sense to me! O.O
2 Answers
Lady Do While
6,027 PointsFound out that this is called "relative flex" and the extra space is evenly distributed to the boxes, so box 1 would be 100px+ 1/3 of the extra space, and the others would receive the other 2/3, evenly. This is different that "absolute flex" where the total items' space is calculated evenly, instead of just the extra space. Here's a picture that I figured would explain it but I couldn't wrap my mind around it.
Kallil Belmonte
35,561 PointsMaybe this article will help you..
Lady Do While
6,027 PointsI have spent hours on that page and other websites trying to figure it out. The CSS Tricks page is good for understanding the individual properties but I am not getting how the influence each other. This picture seemed to help, but then as I tried fiddling with the code, I realized I am definitely missing something in regards to how they relate to one another.
Kallil Belmonte
35,561 PointsKallil Belmonte
35,561 PointsGreat!
Sorry I have not helped you...
(Você não é brasileira né?)
Lady Do While
6,027 PointsLady Do While
6,027 PointsI have a Portuguese name, but that ancestor was many generations ago!