HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

flex

Description

The flex property for CSS is shorthand for flex-grow, flex-shrink, and flex-basis.

Syntax

CSS

flex: value;

JS

object.style.flex = "value";

Values

<'flex'> = none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]
none

Expands to 0 0 auto.

<'flex-grow'> = <number [0,∞]>
<number [0,∞]>

An integer or zero or more decimal digits followed by a dot (.) followed by one or more decimal digits. The first character may be preceded by a positive sign (+). The last character may be succeeded by an exponent (e or E) and an integer.

<'flex-shrink'> = <number [0,∞]>
<number [0,∞]>

An integer or zero or more decimal digits followed by a dot (.) followed by one or more decimal digits. The first character may be preceded by a positive sign (+). The last character may be succeeded by an exponent (e or E) and an integer.

<'flex-basis'> = content | <'width'>
content

Indicates an automatic size based on the flex item's content.

<'width'> = auto | <length-percentage> | min-content | max-content | fit-content( <length-percentage> )
auto

Automatically specified by the user agent.

<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

min-content

Represents the largest min-content contribution of the items occupying the track.

max-content

Represents the largest max-content contribution of the items occupying the track.

fit-content()

Represents the formula max(minimum, min(limit, max-content)), where minimum represents an auto minimum (which is often, but not always, equal to a min-content minimum), and limit is the track sizing function passed as an argument to fit-content(). This is essentially calculated as the smaller of minmax(auto, max-content) and minmax(auto, limit).

Initial

0 1 auto

Examples

1 · flex-basis · auto

2 · flex-basis · content

3 · flex-basis · length

4 · flex-basis · max-content

5 · flex-basis · min-content

6 · flex-basis · percentage

7 · flex-grow

8 · flex-shrink

9 · none

10 · JS