THE WORLD'S LARGEST WEB DEVELOPER SITE

Style flexShrink Property

❮ Style Object

Example

Let the blue DIV element shrink five times more than the rest of the flexible items:

document.getElementById("myBlueDiv".style.flexShrink = "5";
Try it Yourself »

Definition and Usage

The flexShrink property specifies how the item will shrink relative to the rest of the flexible items inside the same container.

Note: If the element is not a flexible item, the flexShrink property has no effect.


Browser Support

Property
flexShrink Yes 11.0 Yes 6.1 WebkitFlexShrink Yes

Syntax

Return the flexShrink property:

object.style.flexShrink

Set the flexShrink property:

object.style.flexShrink="number|initial|inherit"

Property Values

Value Description
number A number specifying how much the item will shrink relative to the rest of the flexible items. Default value is 0
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

Technical Details

Default Value: 1
Return Value: A String, representing the flex-shrink property of an element
CSS Version CSS3

Related Pages

CSS reference: flex-shrink property

HTML DOM STYLE Reference: flex property

HTML DOM STYLE Reference: flexBasis property

HTML DOM STYLE Reference: flexDirection property

HTML DOM STYLE Reference: flexFlow property

HTML DOM STYLE Reference: flexGrow property

HTML DOM STYLE Reference: flexWrap property


❮ Style Object