CSS Flexbox Flashcards
display: flex
Adding this to an element turns it into a flex container.
flex-direction
Used to align any children of that element into rows or columns.
flex-direction options
- Row
- Column
- Row-reverse
- Column-reverse
justify-content:
A property used to align and space-out flex-items a certain way. It aligns flex items along the main axis.
justify-content: flex-start;
aligns items to the start of the flex container. For a row, this pushes the items to the left of the container. For a column, this pushes the items to the top of the container. This is the default alignment if no justify-content is specified.
justify-content: center;
aligns all the flex items to the center inside the flex container.
justify-content: flex-end;
aligns items to the end of the flex container. For a row, this pushes the items to the right of the container. For a column, this pushes the items to the bottom of the container.
justify-content: space-between;
aligns items to the center of the main axis, with extra space placed between the items. The first and last items are pushed to the very edge of the flex container. For example, in a row the first item is against the left side of the container, the last item is against the right side of the container, then the remaining space is distributed evenly among the other items.
justify-content: space-around;
similar to space-between but the first and last items are not locked to the edges of the container, the space is distributed around all the items with a half space on either end of the flex container.
justify-content: space-evenly;
Distributes space evenly between the flex items with a full space at either end of the flex container.
align-items:
A proper that is similar to justify-content. However it aligns flex items via the cross -axis which is the opposite of the main axis that justify-content uses.
align-items: flex-start;
aligns items to the start of the flex container. For rows, this aligns items to the top of the container. For columns, this aligns items to the left of the container.
align-items: flex-end;
aligns items to the end of the flex container. For rows, this aligns items to the bottom of the container. For columns, this aligns items to the right of the container.
align-items: center;
align items to the center. For rows, this vertically aligns items (equal space above and below the items). For columns, this horizontally aligns them (equal space to the left and right of items).
align-items: stretch;
stretch the items to fill the flex container. For example, rows items are stretched to fill the flex container top-to-bottom. This is the default value if no align-items value is specified.