flex-basis

The flex-basis CSS property sets the flex-basis longhand, which specifies the flex basis: the initial main size of the flex item, before free space is distributed according to the flex factors.

Syntax

CSS

flex-basis: value;

JS

object.style.flexBasis = "value";

Values

<'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

auto

Examples

auto

content

length

max-content

min-content

percentage

JS

Internal

flex

flex-grow

flex-shrink

External

World Wide Web Consortium (W3C)

Home Menu