...

/

Flex Shorthand Notation

Flex Shorthand Notation

In this lesson, we will look at how the flex CSS property gives us a compact way to control the flex-grow, flex-shrink, and flex-basis values in one rule.

We'll cover the following...

Flex

The flex property is a shorthand notation for specifying the flex-grow, flex-shrink, and flex-basis properties in one rule.

The format of flex looks as follows:

.flex-item {
  flex: <flex-grow> <flex-shrink> <flex-basis>;
}

Example:

.flex-item {
  flex: 2 3 400px;
}

The above example is equivalent with the following properties:

.flex-item {
  flex-grow: 2;
  flex-shrink: 3;
  flex-basis: 400px;
}

It is important to note that ...