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 trialJohn Yzaguirre
22,025 Pointsflex-basis is a little confusing can someone who understands elaborate?
So I was messing around with flex-basis to see what it is doing and I can't really peg down the behavior. I tried using no-wrap instead on the .row class and it positioned all the columns on one line BUT it made the center column the same width as the side columns. So flex-basis is the way to go for sure. But why? How does it do whatever it is doing? Thanks for any help with this.
3 Answers
Jonathan Grieve
Treehouse Moderator 91,253 PointsFlex basis is a property that sets the initial size of a flex item.
You can use it to set the width or height of a flex item, or every flex item and then distributes the rest of the available space.
flex-basis: 100%;
Check out this useful article on flex basis. https://css-tricks.com/almanac/properties/f/flex-basis/
Robert Andrade
7,554 PointsI know this is not actually what was asked but I tried using the flex-wrap: nowrap at the second media query and it also worked the same as the flex-basis idea, at least in this specific instance.
Robert Szabo
7,999 PointsWell I also tried out what you wrote, but it only partially worked that way. Without setting the flex-basis to 0, you cannot apply the flex-grow: 1.4 value. All 3 columns will be the same size.
Benjamin Hedgepeth
5,672 PointsFlex basis essentially overrides any previously set width/height on an element once it becomes a flex item.