CSS Basic Tutorial
CSS Flexbox
flex container enables a flexbox layout, which provides powerful and efficient ways to align and distribute space among items in the container, even when their sizes are dynamic or unknown.
The flex-direction
property in CSS specifies the direction in which flex items are placed in a flex container. It determines the main axis along which the items are laid out, and it plays a critical role in how your layout is structured.
flex-direction: row | row-reverse | column | column-reverse;
Determines whether the flex items should wrap to the next line if they overflow:
flex-wrap: wrap | no-wrap | wrap-reverse;
Shorthand for flex-direction
and flex-wrap
.
Aligns items along the main axis:
justify-content : flex-start | flex-end | center | space-between | space-around | space-evenly;
Aligns items along the cross axis:
align-items : flex-start | flex-end | center | baseline | stretch;
Aligns multiple rows of flex items when flex-wrap
is applied:
align-content : flex-start | flex-end | center | stretch | space-between | space-around | space-evenly;
Defines spacing between flex items:
row-gap
for horizontal spacing.column-gap
for vertical spacing.gap
for both.gap : value cloumn-gap : value row-gap : value