Styleflex Property
Example
Let all the flexible items be the same length, regardless of its content:
y[i].style.flex = "1";
}
Description
The flex property sets or returns the length of the item, relative to the rest of theflexible items inside the same container.
The flex property is a shorthand for the flexGrow, flexShrink, and the flexBasis properties.
Note: If the element is not a flexible item, the flex property has no effect.
Browser Support
| Property | |||||
|---|---|---|---|---|---|
| flex | Yes | 11.0 | Yes | 9.0 | Yes |
Syntax
Return the flex property:
Set the flex property:
Property Values
| Value | Description |
|---|---|
| flex-grow | A number specifying how much the item will grow relative to the rest of the flexible items |
| flex-shrink | A number specifying how much the item will shrink relative to the rest of the flexible items |
| flex-basis | The length of the item. Legal values: "auto", "inherit", or a number followed by "%", "px", "em" or any other length unit |
| auto | Same as 1 1 auto. |
| initial | Same as 0 1 auto.Read aboutinitial |
| none | Same as 0 0 auto. |
| inherit | Inherits this property from its parent element.Read aboutinherit |
Technical Details
| Default Value: | 0 1 auto |
|---|---|
| Return Value: | A String, representing the flex property of an element |
| CSS Version | CSS3 |
Related Pages
CSS reference:flex property
HTML DOM STYLE Reference:flexBasis 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

