CSS flex-shrink property

CSS flex-shrink property CSS reference manual


Let the second element shrink to one-third of the other elements:

div:nth-of-type(2) {flex-shrink: 3;}

Try it out . . .

Browser support

The numbers in the table support the version number of the first browser for this property.

The number immediately after -webkit-, -ms - or -moz - is the first version that supports the prefix property.

Property
flex-shrink 29.0
21.0 -webkit-
11.0
10.0 -ms-
28.0
18.0 -moz-
9.0
6.1 -webkit-
17.0

Definitions and usages

The flex-shrink property is used to set or retrieve the shrinkage ratio of the elastic box.

Note: If the element is not an element of an elastic box object, the flex-shrink property has no effect.

Default: 1
Inherited: Whether
Animated: Is. S ee Animation . Give it a try
Version: CSS3
JavaScript syntax: object .style.flexShrink="5" Give it a try


CSS syntax

flex-shrink: number |initial|inherit;

The property value

value describe
number A number, the specified item will shrink with other flexible projects.The default is 0.
initial Set this property for its default value.See initial
inherit Inheriting this property from the parent element.See inherit


Related articles

CSS Reference Manual: flex attribute

CSS Reference Manual: flex-basis properties

CSS Reference Manual: flex-direction properties

CSS Reference Manual: flex-flow properties

CSS Reference Manual: flex-grow property

CSS Reference Manual: flex-wrap properties


CSS flex-shrink property CSS reference manual