CSS3 flex-grow
Property
Topic: CSS3 Properties ReferencePrev|Next
Description
The flex-grow
CSS property specifies how the flex item will grow relative to the other items inside the flex container.
The following table summarizes the usages context and the version history of this property.
Default value: | 0 |
---|---|
Applies to: | Flex items |
Inherited: | No |
Animatable: | Yes. See animatable properties. |
Version: | New in CSS3 |
Syntax
The syntax of the property is given with:
The example below shows the flex-grow
property in action.
Example
Try this code ».flex-container {
display: flex;
}
.item1 {
width: 100px;
background: #ff80c0;
-webkit-flex-grow: 1; /* Safari 6.1+ */
flex-grow: 1;
}
.item2 {
width: 100px;
background: #8080ff;
-webkit-flex-grow: 3; /* Safari 6.1+ */
flex-grow: 3;
}
.item3 {
width: 100px;
background:#0080ff;
-webkit-flex-grow: 5; /* Safari 6.1+ */
flex-grow: 5;
}
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
number | A positive number that determines the flex grow factor of the flex item. The default value is 0. Negative numbers are invalid. |
initial |
Sets this property to its default value. |
inherit |
If specified, the associated element takes the computed value of its parent element flex-grow property. |
Browser Compatibility
The flex-grow
property is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: CSS3 Multi-column Layouts.
Related properties: align-content
, align-items
, align-self
, display
, flex
, flex-basis
, flex-direction
, flex-flow
, flex-shrink
, flex-wrap
, justify-content
, min-height
, min-width
, order
.