Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
The justify-content property lets you control the position and alignment of flex container items on the main axis, as well as how much space is between flex items. Learn about how to manipulate flex spacing using `justify-content`, `justify-content: space-between`, and `margin: auto`.
Resources
Video review
- You apply the
justify-content
property to flex containers only. - The
justify-content
property lets you control the position and alignment of flex Items on the main axis and how space should be distributed in a flex container. - The default value for
justify-content
isflex-start
, which places items towards the start of each flex line. - To place items at the end of the flex line, set
justify-content
toflex-end
. - The value
center
places flex items in the center of the line, with equal amounts of empty space between the line's start edge and the first item, and between the end edge and the last item. - The value
space-between
displays equal spacing between flex items. - For equal spacing around every flex item, use the value
space-around
. - A margin set to
auto
will absorb any extra space around a flex item and push other flex items into different positions.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up