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 trialgoshgarhuseynov
Front End Web Development Techdegree Student 10,873 PointsWhat is the display:flex and justify-content: space-around used for?
What is the display:flex and justify-content: space-around used for? Unfortunately it is not explained in video lectures. Thanks.
1 Answer
Matthew Long
28,407 PointsFlex is a pretty large css concept to explain on here. You'd be better off taking a look at the guide to flexbox on css-tricks.
There is also a course solely on flex here on Treehouse.
Basically, flex is a css property that is used for layouts and positioning. The main idea behind the flex layout is to give the container the ability to alter its items' width/height (and order) to best fill the available space (mostly to accommodate to all kind of display devices and screen sizes).
The justify-content: space-around;
property is where items are evenly distributed in the line with equal space around them. Note that visually the spaces aren't equal, since all the items have equal space on both sides. The first item will have one unit of space against the container edge, but two units of space between the next item because that next item has its own spacing that applies.