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 trialMichael Pashkov
22,024 PointsCan we do this as a variant? flex: 2 200px;
.item { flex: 1 200px;
}
.item-2 { flex: 2 200px; }
instead of
.item { flex: 1 200px; }
.item-2 { flex-grow: 2; }
1 Answer
Michael Pashkov
22,024 PointsThank you Shaun Wong for your reply. Guil said we should do this way when declaring flex-grow for independent item. After declaring for all items. And I was just queries...
item { flex: 1 200px; } // for all
.item-2 { flex-grow: 2; } // for one as a second declaration replace with .item-2 { flex: 2 200px; }
Shaun Wong
14,489 PointsShaun Wong
14,489 PointsI don't see why it wouldn't work. Best to test it and see if the results are the same as you were looking for.
The shorthand for two values are Flex grow, and Flex basis.
View MDN for the other shorthand properties. https://developer.mozilla.org/en-US/docs/Web/CSS/flex