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!
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
Iulia Copaci5,039 Points
Use justify-content to adjust?
I was just wondering, when do we use flex: 1; versus justify-content: space-between; to give the .col the same size?
Steve McKinney29,274 Points
If I understand correctly
justify-content: space-between distributes space between each element providing they are able to have space between them. eg: two 50% (width/flex-basis) elements will have no space between, where as two 49% (width/flex-basis) elements would have a 2% space between them.
You can use
flex: 1 and
justify-content: space-between both at the same time, however you would want to make sure that the items have a flex-basis that will allow space, if you want
justify-content: space-between to work as intended.
CSS Tricks has an easy to understand guide, which I would advise going over.