Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style flexShrink Property

Style flexShrink Property

Style Object Reference The Style object

Example

Makes the blue DIV element shrink to one fifth of the other flexible items:

document.getElementById("myBlueDiv".style.flexShrink = "5";

Try it »


Definition and Usage

The flexShrink property specifies how much a item will shrink relative to the other flexible items in the same container.

**Note:** The flexShrink property has no effect if the element is not a flexible item.


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

Firefox, Opera and Chrome support the flexShrink property.


Syntax

Returns the flexShrink property:

object

.style.flexShrink

Sets the flexShrink property:

object

.style.flexShrink="

number

|initial|inherit"

Attribute values

Value Description
number A number that specifies how much the item will shrink relative to the other flexible items. The default value is 0.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical Details

Default value: 1
Return Value: A string that represents the flex-shrink property of an element.
CSS version CSS3

Related Articles

CSS Reference Manual:flex-shrink Property

HTML DOM STYLE Reference Manual:flex Property

HTML DOM STYLE Reference Manual:flexBasis Property

HTML DOM STYLE Reference Manual:flexDirection Property

HTML DOM STYLE Reference Manual:flexFlow Property

HTML DOM STYLE Reference Manual:flexGrow Property

HTML DOM STYLE Reference Manual:flexWrap Property


Style Object Reference The Style object