Latest web development tutorials

HTML DOM Style flexShrink property

Style Object Reference Style Objects

Examples

Let the blue DIV element shrink to one-fifth of other flexible project:

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

try it"

Definition and Usage

flexShrink attribute specifies the project will be flexible with respect to other items in the same container volume shrinkage.

Note: If theelement is not flexible items, flexShrink property does not work.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Firefox, Opera and Chrome support flexShrink property.


grammar

Back flexShrink properties:

object .style.flexShrink

Setting flexShrink properties:

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

Property Value

描述
number 一个数字,规定项目将相对于其他灵活的项目进行收缩的量。默认值是 0。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

technical details

Defaults: 1
return value: String representing the flex-shrink attribute element.
CSS version CSS3


related articles

CSS Reference Manual: Flex-Shrink property

HTML DOM STYLE Reference: Flex Properties

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 Reference Style Objects