THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Style flexBasis Property

Style Object Reference Style Object

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

Internet Explorer Firefox Opera Google Chrome Safari

The flexBasis property is supported in IE10+, Firefox, Opera, and Chrome.

Note: Safari 6.1+ supports an alternative, the WebkitFlexBasis property.


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 Reference Style Object