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 trialkaran Badhwar
Web Development Techdegree Graduate 18,135 PointsCross Axis
So when we give Flex-direction : column; to our container and I witnessed that if I remove flex-basis its height is getting impacted not the Width, is it because when we change it to Column it's height becomes width and vice-versa and if i put flex-basis : 200px again back its height is stick to 200px not it's width. why is that?
1 Answer
Jason Larson
8,361 PointsThat is (mostly) correct. flex-basis
is dependent on the flex-direction
. It's not so much that width and height become switched as much as it is that flex-basis
refers to the initial length of the item, and when flex-direction: column
, then the length is vertical, and when flex-direction:row
(the default), the length is horizontal. There is a good explanation at this stackoverflow question