row
column
row-reverse
column-reverse
justify-content
aligns items along the main axis. It only works if there is extra space.
flex-start
, flex-end
, center
, space-between
, space-around
, space-evenly
flex-direction: column
align-items
aligns items along the cross axis. It only works if there is extra space in the flex-container.
😲 NOTE: I've set height: auto
on the flex items because the value stretch
only works when a height is not set.
flex-start
, flex-end
, center
, stretch
flex-direction: column
align-self
works exactly the same as align-items
except it is applied to flex children directly. In fact, you can think of align-items
as just a shortcut for setting all of the align-self
of a flex-container's children.
align-self
for some of the flex items: flex-start
, flex-end
, center
align-items
property.flex-direction
to row
and try all three values againflex-grow
determines the rate at which extra space is given to flex items. In this example, child 4 and child 2 are the only items that can grow, but child 4 is snatching up extra space 3 times as fast as child 2.
flex-grow
on various flex items:flex-direction
and experimentflex-basis
is an ideal, or hypothetical width or height, before any growing or shrinking is applied. Think of it as "what each flex item asks for", but the parent can not always give it what it want.
flex-basis
deals with the width
dimension if flex-direction: row
and height
if flex-direction: column
.
flex-direction
propertyflex basis
? Or does the growing child eat up everything? Figure it out by experimentationflex-grow
?order
controls the order that the flex-children are rendered in. You can create any order you want by specifying the order property on the flex items
flex-direction: column
and move child 5 to the very botom of the areaflex-wrap
controls whether the flex children are allowe to wrap to new lines
no-wrap
, wrap
, and wrap-reverse
flex-wrap
is set to no-wrap
does justify-content
have any effect? Why?flex-wrap: wrap
, and now experiment with both justify-content
, and align-items
. See if it makes sense to you why they work the way they do. See if it makes sense to you why they work the way they do.flex-basis: 50px
-- can you explain why they don't wrap, even if set to wrap?flex-direction: column
and repeat the steps abovealign-content
controls the distribution of lines lines of flex children along the cross-axis. It only has an effect if the children are wrapping onto multiple lines.
flex-start
, center
, flex-end
, space-between
, space-around
, space-evenly
, stretch
align-content
and justify-content