FlexBox Notes
Notes of FlexBox container in css and its related properties
HTML
1 |
|
CSS
1 | .container{ |
justify-content
property:
Justify means changing how elements are grouped and spaced on the main axis. To justify flex items, we use the justify-content
property.
Aligns flex items along the main axis of the current line of the flex container.
Values:
- Default:
justify-content : flex-start;
justify-content : center;
justify-content : flex-end;
justify-content : space-around;
justify-content : space-between;
flex-direction
property:
Specifies how flex items are placed in the flex container, by setting the direction of the flex container’s main axis.
Values:
+ Default: row
+ flex-direction : row-reverse;
+ flex-direction : columnn;
+ flex-direction : column-reverse;
### flex-wrap
property:
Controls whether the flex container is single-line or multi-line, and the direction of the cross-axis, which determines the direction new lines are stacked in.
+ Default: flex-wrap : nowrap;
+ flex-wrap : wrap;
+ flex-wrap : wrap-reverse
+ items that don’t fit to go to the top of the container instead of the bottom
### shorthand flex-flow
property:
1
2
flex-direction: row;
flex-wrap: wrap;
can be replaced by:
1
flex-flow: row wrap;
1 | flex-direction: row; |
1 | flex-flow: row wrap; |
align-items
property:
Aligns flex items along the cross axis of the current line of the flex container.
Values:
- Default:
align-items : stretch;
align-items : center;
align-items : flex-start;
- items take the size of their content and are at the beginning of the cross axis.
align-items : flex-end;
align-content
property:
Sets the distribution of space between and around content items along a flexbox’s cross-axis or a grid’s block axis.
- default:
align-content: stretch;
align-content: center;
/* Pack items around the center */align-content: start;
/* Pack items from the start */align-content: end;
/* Pack items from the end */align-content: flex-start;
/* Pack flex items from the start */align-content: flex-end;
/* Pack flex items from the end */