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 CSS Flexbox Layout Flexbox Properties Growing Flex Items

Is it better to use width with percentages or flexbox with flex-grow to make two columns with a given ratio?

At the end of this video, he gives an example of using flexboxs to make the main content div four times that of an aside. Is it better to do that or use width with percentages?

to be sure i use this.

.foo {
  flex-basis: 50%;
  max-width: 50%;
}

1 Answer

Hey, Jordan!

There's no "best way" to do things when it comes to coding. Sure there are "best practices", but this is one of those things where it doesn't fully matter which route you take to reach your end goal.

Although, personally, since using flexbox, it's about all I use for layouts. It just makes things so easy and it cuts a lot of work out from making your layouts. It's just a personal preference. I guess it's kind of like making a cake from scratch vs. using a box mix to make a cake. One way takes more effort than the other, but really it just comes down to taste and which one you prefer. I prefer box mixes. :)

Great cake analogy. Up vote from me just for that.