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!

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

CSS CSS Flexbox Layout Flexbox Properties Flexbox Properties Review

Which 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?

Adriana Cabrera
Adriana Cabrera
14,618 Points

This 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.

1 Answer

Steven Parker
Steven Parker
228,026 Points

A 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.

Thank you for your help