e01.org

`<flex>` CSS type

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>`** [CSS](/docs/Web/CSS) [data type](/docs/Web/CSS/Reference/Values/Data_types) denotes a flexible length within a grid container. It is used in grid-template-columns, grid-template-rows and other related properties.

## Syntax

The `<flex>` data type is specified as a &lt;number&gt; 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.

## Examples

### Examples of correct values for the fr data type

```plain
1fr /* Using an integer value */
2.5fr /* Using a float value */
```

### Example of use in a track listing for CSS grid layout

```css
.grid {
display: grid;
grid-template-columns: 1fr 1fr 2.5fr 1.5fr;
}
```

## Specifications

## Browser compatibility

## See also

- [CSS grid layout](/docs/Web/CSS/Guides/Grid_layout)

source: MDN Web Docs mirror · page

Cite this

"` ` CSS type". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/flex_value

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·