English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
flex-The initial base value of the elastic element specified by the basis CSS property
The table below provides usage instructions and version history for this attribute, as well as the usage syntax in the JavaScript script.
Default Value: | auto |
---|---|
Applies To: | Flexible Items |
Inheritance: | No |
Animatable: | Yes.Please refer to Animation Attributes. |
Version: | CSS3new feature |
JavaScript Syntax: | object.style.flexBasis="180px" |
The syntax of this attribute is as follows:
flex-basis: width | auto | initial | inherit
The following examples demonstrate how to use flex-basis Attribute.
.flex-container { display: flex; } .item1 { background: #ff80c0; -webkit-flex-basis: 300px; /* Safari 6.1+ */ flex-basis: 300px; } .item2 { background: #8080ff; -webkit-flex-basis: 30%; /* Safari 6.1+ */ flex-basis: 30%; } .item3 { width: 120px; background:#0080ff; }Test and see‹/›
The table below describes the value of this attribute.
Value | Description |
---|---|
width | Length represented by an absolute or relative unit, used to specify the initial length of the flexible item. Negative values are invalid. |
auto | The width of the flexible item is equal to itswidthThe value of the attribute. If the width is not specified for the flexible item, the width will depend on its content. This is the default value. |
initial | Set this attribute to its default value. |
inherit | If specified, the associated elements adopt the flex of their parent element-basis Attribute Values. |
flex-Browser Compatibility of basis Attribute, the numbers in the table below represent the minimum version of the browser that supports this attribute; all mainstream browsers support this attribute.
|
Please refer to the following tutorials:CSS3Multi-column Layout.
Related Attributes:align-content,align-items,align-self,display,flex,flex-direction,flex-flow,flex-grow,flex-shrink,flex-wrap,justify-content,min-height,min-width,order.