CSS flex-basisProperty

CSS Reference


Example

Set the initial length of the second flex item to 80 pixels:

div:nth-of-type(2) {flex-basis: 80px;}

Try it Yourself »

Browser Support

The numbers in the table indicate the first browser version that supports the property.

The number following -webkit-, -ms-, or -moz- is the first version that supports the prefixed property.

Property
flex-basis 29.0
21.0 -webkit-
11.0
10.0 -ms-
28.0
18.0 -moz-
9.0
6.1 -webkit-
17.0

Definition and Usage

The flex-basis property is used to set or retrieve the flex base size of a flex item.

Note:If the element is not a flex item, the flex-basis property has no effect.

Default value: auto
Inherited: no
Animatable: Yes. SeeAnimatable。 Try it Yourself
version: CSS3
JavaScript Syntax: object.style.flexBasis="200px" Try it Yourself


CSS Syntax

flex-basis: number|auto|initial|inherit;

Property value

Value Description
number A length unit or a percentage that specifies the initial length of the flexible item.
auto Default value. The length is equal to the length of the flexible item. If the item has no length specified, the length will be determined based on its content.
initial Sets this property to its default value. Seeinitial。
inherit Inherits this property from its parent element. Seeinherit。


Related Articles

CSS Reference:flex property

CSS Reference:flex-direction property

CSS Reference:flex-flow property

CSS Reference:flex-grow property

CSS Reference:flex-shrink property

CSS Reference:flex-wrap property


CSS Reference

other extensions