<flex>

<flex> CSS 数据类型 表示了网格(grid)容器中的一段可变长度。于grid-template-columnsgrid-template-rows及相关属性中使用。

语法

<flex>数据类型为一<number>后加单位fr。与所有CSS尺寸相同,单位与数字间无空格。

Examples

1fr    /* 使用整型 */
2.5fr  /* 使用浮点 */

规范

规范 状态 注释
CSS Grid Layout
<flex>
Candidate Recommendation 初步定义

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
<flex>Chrome Full support 29Edge Full support 12Firefox Full support 40IE Full support 10Opera Full support 28Safari Full support 10.1WebView Android Full support 57Chrome Android Full support 29Firefox Android Full support 40Opera Android Full support 28Safari iOS Full support 10.3Samsung Internet Android Full support 2.0

Legend

Full support  
Full support

See also