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

CSS

Length units for flexbox

What is considered the best length unit for flexbox? Using pixels (along with setting flex to 1) on flex items causes them to "flex" more easily than using percentages as far as I can tell.

I understand mostly how the components of flexbox work. However, I really can't find anything on how to best implement flexbox regarding sizing and lengths?

1 Answer

One of the points of flexbox is that there are no fixed units this is what makes it so powerful.

On the flex-container, and to an extent on the flex-items, you can set fixed measurements. For example, you can make the max-width of a flex-item to 50%, and thus limiting the extent to which flexbox can manipulate the width of your element.