Style flexBasis Property
Example
Set the initial length of a flex-item to 200 pixels:
document.getElementById("myBlueDiv").style.flexBasis = "200px";
Try it Yourself »
Definition and Usage
The flexBasis property specifies the initial length of a flexible item.
Note: If the element is not a flexible item, the flexBasis property has no effect.
Browser Support
Property | |||||
---|---|---|---|---|---|
flexBasis | Yes | 11.0 | Yes | 9.0 | Yes |
Syntax
Return the flexBasis property:
object.style.flexBasis
Set the flexBasis property:
object.style.flexBasis = "number|auto|initial|inherit"
Property Values
Value | Description |
---|---|
number | A length unit, or percentage, specifying the initial length of the flexible item(s) |
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 according to its content |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Technical Details
Default Value: | auto |
---|---|
Return Value: | A String, representing the flex-basis property of an element |
CSS Version | CSS3 |
Related Pages
CSS reference: flex-basis property
HTML DOM STYLE Reference: flex property
HTML DOM STYLE Reference: flexDirection property
HTML DOM STYLE Reference: flexFlow property
HTML DOM STYLE Reference: flexGrow property
HTML DOM STYLE Reference: flexShrink property
HTML DOM STYLE Reference: flexWrap property
❮ Style Object