CSS Flexbox Flashcards
What is Flexbox
One-dimensional layout method for laying out items in rows or columns.
Why use Flexbox?
Allows us to distribute space dynamically across elements of an unknown size.
How do you turn on flexbox property?
display: flex;
What is main axis in flexbox?
By default main axis = x (horizontal left to right but can change)
What is cross axis?
By default cross axis = y(vertical top to bottom but can change)
Define Flex direction
Allows us to decide the direction of main axis in container.
flex-direction: row; (default)
How do you go right to left in direction?
flex-direction: row-reverse;
How do you go up to down in direction?
flex-direction: column;
How do you go down to up in direction?
flex-direciton: column-reverse;
Define justify content
Justify content determines how the actual elements/content is distributed across the main axis. Dependent on how the flex direction is configured.
What are the values for the property justify-content:
justify-content: flex-start; **default justify-content: flex-end; justify-content: center; justify-content: space-between; justify-content: space-around; justify-content: space-evenly;
Define Flex Wrap
Determines whether elements are going to wrap along main. And dictates the direction of the cross axis.
What are the values of flex-wrap:
flex-wrap: wrap;
flex-wrap: wrap-reverse;
flex-wrap: nowrap;
Define align items.
Distributes space/items along the cross axis.
What are the values of align-items:
align-items: flex-start; **default
align-items: flex-end;
align-items: center;
align-items: baseline;