Flexbox Flashcards
flex-direction:
Sets the display direction of flex items:
row [default]
row-reverse
column
column-reverse
flex-wrap:
Specifies whether flex items should wrap or not:
wrap
nowrap (default)
wrap-reverse
flex-flow:
Shorthand for setting flex-direction then flex-wrap:
flex-flow: flex-direction flex-wrap
justify-content:
Align items on the x-axis/cross axis/horizontal axis:
flex-start [default] flex-end center space-around space-between
justify-content: flex-start
Display items at the beginning of the cross axis
justify-content: flex-end
Display items at the end of the cross axis
justify-content: center
Display items at the center of the cross axis
justify-content: space-around
Display items with space before, between, and after the items
justify-content: space-between
Display items on the cross axis with equal space between the items
align-items:
Align items on the y-axis/vertical axis:
center flex-start flex-end stretch [default] baseline
align-items: center
Display items in the middle of the y-axis
align-items: flex-start
Display items at the top of the y-axis
align-items: flex-end
Display items at the bottom of the y-axis
align-items: stretch
Stretches the items to fill the entire y-axis container (default)
align-items: baseline
Aligns items along their typographical baseline
align-content:
Align the flex lines between flex items:
space-between space-around stretch center flex-start flex-end
align-content:space-between
Displays flex lines with equal space between them
align-content: space-around
Displays flex lines with equal space before, between, and after them
align-content: stretch (default)
Stretches the flex lines to fill it’s y-axis container
align-content: center
Displays the (group) of flex lines in the middle of the container
APPLICATION:
Perfect Centering with Flexbox
SOLUTION
Set both justify-content and align-items to center
FLEX ITEM:
order:
Specify the order of the flex item (zero based):
-1
0 [default]
1
2
FLEX ITEM:
flex-grow:
Specify how much a flex item will grow relative to other flex items:
0 [default]
1
2 (2x as fast)
8 (8x as fast)
FLEX ITEM:
flex-shrink:
Specify how much a flex item will shrink relative to other flex items:
0
1 [default]
FLEX ITEM:
flex-basis:
Specify the initial length (width) of a flex item:
50px
50rem
50%
FLEX ITEM:
flex:
Shorthand property for flex-grow, flex-shrink, and flex-basis
flex: 1 0 50%
flex: [flex-grow] [flex-shrink] [flex-basis]
FLEX ITEM:
align-self:
Specify the alignment for the selected item inside the flex container:
baseline stretch center flex-start flex-end