The Flex Container Properties - Understanding Flexbox: Everything you need to know
“Baseline” really sounds fancy.
“Baseline” really sounds fancy.
The result appears to look just like flex-start
but it is subtly different.
What the heck is “baseline”?
The image below should help.
Notice how all the flex-items are aligned to have their content seat on the “baseline”?
6. Align-content
While discussing the wrap
property, do you remember what happened when you added more flex-items to the flex-container?
You got a multi-line flex container.
The align-content
property is used on multi-line flex-containers.
It takes the same values as align-items
apart from baseline.
By definition, it controls how the flex-items are aligned in a multi-line flex container.
Just like align-items
, the default value is also stretch
These are values you should now be familiar with. So, here’s how they affect a multi-line flex-container with 10 flex-items.
(i) Stretch
With stretch
, the flex items are “stretched” to fit the available space along the cross-axis.
The spacing you see between the flex items below is owing to the margin
set on the items.
(ii) Flex-start
You’ve seen the flex-start
value before.
This time it aligns the items in the multi-line container to the start of the cross-axis.
Remember the default cross axis is from top-to-down.
Thus, the flex items are aligned to the top of the flex container.
(iii) Flex-end
The flex-end
value aligns the flex items to the end of the cross-axis.
(iv) Center
Like you may have guessed, center
aligns the flex-items to the center of the cross-axis.
That’s the last of the flex-container properties.
You now understand how to use the various flex-container properties. You’ll use these to work through the practical sections coming up in the lessons that come.
Comments
Post a Comment
Share your thoughts!