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 trialMegan Case
6,809 PointsWhich of the following rules will display the layout shown in the image?
I have tried answering it multiple times but I can never seem to get the correct answer. The options are as follows:
.col { flex: 150%; }
.col { flex: 100px; }
.col { flex: 1; }
Does it have to do with the % vs px? Why can't I find the right answer?
1 Answer
Steven Parker
231,236 PointsA single value given to the "flex" shorthand is assumed to be a setting for "flex-basis" if it has any unit, and for "flex-grow" if just a number.
Hint: The correct answer is a unitless value that causes each column to take up the same amount of space relative to the others.
Megan Case
6,809 PointsThank you for your help
Adriana Cabrera
14,618 PointsAdriana Cabrera
14,618 PointsThis is the right answer col { flex: 1; } If an element has flex: 1, this means the size of all of the other elements will have the same width as their content. All .col will have the same width.