Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS flex-basis property

CSS flex-basis property

CSS Reference Manual CSS Reference Manual

Example

Set the initial length of the second flexbox element to 80 pixels:

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

Try it »


Browser support

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

The number immediately 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 basis value of a flexbox.

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

Default value: auto
Inherited: No
Animatable: Yes. See Animatable. Try it
Version: CSS3
JavaScript syntax: object.style.flexBasis="200px" Try it

CSS Syntax

flex-basis:

number

|auto|initial|inherit;

Attribute values

Value Description
number A length unit or a percentage that specifies the initial length of a flexible item.
auto Default value. The length is equal to the length of the flexible item. If no length is specified for the item, the length is determined by its content.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Related Articles

CSS Reference Manual:flex Property

CSS Reference Manual:flex-direction Property

CSS Reference Manual:flex-flow Property

CSS Reference Manual:flex-grow Property

CSS Reference Manual:flex-shrink Property

CSS Reference Manual:flex-wrap Property

CSS Reference Manual CSS Reference Manual