Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

flex-shrink

概述

CSS flex-shrink 属性指定了flex item的收缩规则。

The CSS flex-shrink property specifies the flex shrink factor of a flex item. 

初始值1
适用元素flex items, including in-flow pseudo-elements
是否是继承属性
适用媒体visual
计算值as specified
是否适用于 CSS 动画yes, as a number
正规顺序the unique non-ambiguous order defined by the formal grammar

更多属性和定义请参见使用CSS Flexible boxes

See Using CSS flexible boxes for more properties and information.

语法

Formal syntax: <number>
flex-shrink: 2

flex-shrink: inherit

取值

<number>
负值是不被允许的。
See <number>. Negative values are invalid.

例子

element { 
  flex-shrink: 3;
}

规范

Specification Status Comment
CSS Flexible Box Layout Module
flex-shrink
Candidate Recommendation  

浏览器兼容性

Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari
Basic support 18.0 (18.0) (behind a pref) [1]
20.0 (20.0) [2]
21.0-webkit 11 [3] 12.10 8.0-webkit
Feature Firefox Mobile (Gecko) Android IE Phone Opera Mobile Safari Mobile
Basic support 18.0 (18.0) (behind a pref) [1]
20.0 (20.0) [2]
? 未实现 12.10 未实现

[1] Firefox supports only single-line flexbox until Firefox 28. To activate flexbox support, for Firefox 18 and 19, the user has to change the about:config preference "layout.css.flexbox.enabled" to true.

[2] Before Firefox 32, Gecko wasn't able to animate values starting or stopping at 0.

[3] Internet Explorer 10 uses 0 instead of 1 as the initial value for the flex-shrink property. A workaround is to always set an explicit value for flex-shrink. See Flexbug #6 for more info.

参考

文档标签和贡献者

标签: 
 此页面的贡献者: Sebastianz, fscholz, BenFei, Go7hic, FredWe
 最后编辑者: Sebastianz,