The <flex>
CSS data type denotes a flexible length within a grid container. It is used in grid-template-columns
, grid-template-rows
and other related properties.
The <flex>
data type is specified as a <number>
followed by the unit fr
. The fr
unit represents a fraction of the leftover space in the grid container. As with all CSS dimensions, there is no space between the unit and the number.
1fr /* Using an integer value */ 2.5fr /* Using a float value */
Specification | Status | Comment |
---|---|---|
CSS Grid Layout The definition of '<flex>' in that specification. | Candidate Recommendation | Initial definition. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 29 | 16 | 40 | No | 28 | 10.1 |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | 57 | 29 | 16 | 40 | 44 | 10.3 | Yes |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/flex_value