CSS Flexbox
CSS Flexbox
.flex-container { .flex-container {
display: flex; display: flex;
Flex- flex-flow: row wrap;
direction:row;
flex-wrap:
wrap; }
}
The Justify-Content Property
The justify-content property is used to align the flex items. The values that this property can
take are as follows:
Center
flex-start
flex-end
space-around
space-between.
The center value aligns the flex items at the center of the container.
The flex-start value aligns the flex items at the beginning of the container (this is default).
The flex-end value aligns the flex items at the end of the container
The space-around value displays the flex items with space before, between, and after the lines.
The space-between value displays the flex items with space between the lines.
The Align-Items Property
The align-items property is used to align the flex items. The values that this
property can be set to are:
Center
flex-start
flex-end
Stretch
baseline.
The center value aligns the flex items in the middle of the container
The flex-start value aligns the flex items at the top of the container
The flex-end value aligns the flex items at the base of the container
The stretch value stretches the flex items to fill the container (this is default)
The baseline value aligns the flex items based on their text baselines
The Align-Content Property
The align-content property is used to align the flex lines. The value that this
property can be set to is:
space-between
space-around or stretch.
The space-between value displays the flex lines with equal space between
them.
The space-around value displays the flex lines with space before, between
and after them.
The stretch value stretches the flex lines to take up the remaining space (this is
default).
Perfect Centring
To perform perfect centring using the flexbox collection of
properties, set both justify- content and align-items properties
to centre.
For example:
.flex-container {
display: flex;
justify-content: center;
align-items: center;
}