Layout

Display

Direction

The Direction property only works when the display property is set to flex.

Justify

The justify-content property only works when the display property is set to flex. It is used to align the flex items along the main axis within a flex container. When only display: flex is set, justify-content becomes applicable. The property takes the following values:

Align

The align-items property only works when the display property is set to flex. It is used to align the flex items along the cross axis within a flex container. The values for align-items are:

Flex wrap

The flex-wrap property is used to control how flex items are wrapped within a flex container.

The flex-wrap property has three possible values: nowrap, wrap, and wrap-reverse.

  • nowrap (default): all flex items will be on one line.

  • wrap: flex items will wrap onto multiple lines, from top to bottom.

  • wrap-reverse: flex items will wrap onto multiple lines from bottom to top.

Grow

flex-grow is used to control the proportion of available space inside a flex container that a flex item should take up. It accepts a unitless value and serves as a means to dictate how much a flex item should grow if necessary. By default, the value is 0, meaning the item will not grow.

If all items within a flex container have a flex-grow value of 1, the remaining space will be distributed equally among all the items. If one item has a value of 2, for example, it will take up twice as much space as the others.

Shrink

The flex-shrink property determines a flex item's shrink rate in comparison to other items in the container when there's insufficient space. It accepts a unitless value, with a default of 1, meaning the higher the value, the more the item shrinks.

Column Gap

This property only works when the display property is set to flex. It sets the size of the gap between the columns in a grid container.

Row Gap

This property only works when the display property is set to flex. It sets the size of the gap between the rows in a grid container.

Last updated