CSS PROPERTIES
Expand All | Collapse All
CSS AT-RULES

CSS3 flex-shrink Property

Topic: CSS3 Properties ReferencePrev|Next

Description

The flex-shrink CSS property specifies how the flex item will shrink relative to the other items inside the flex container.

The following table summarizes the usages context and the version history of this property.

Default value: 1
Applies to: Flex items
Inherited: No
Animatable: Yes. See animatable properties.
Version: New in CSS3

Syntax

The syntax of the property is given with:

flex-shrink: 
number | initial | inherit

The example below shows the flex-shrink property in action.

.flex-container {
    display: flex;
} 
.item1 {
    width: 100px;
    background: #ff80c0;
    -webkit-flex-shrink: 1; /* Safari 6.1+ */
    flex-shrink: 1;
}
.item2 {
    width: 100px;
    background: #8080ff;
    -webkit-flex-shrink: 3; /* Safari 6.1+ */
    flex-shrink: 3;
}
.item3 {
    width: 100px;
    background:#0080ff;
    -webkit-flex-shrink: 5; /* Safari 6.1+ */
    flex-shrink: 5;
}

Property Values

The following table describes the values of this property.

Value Description
number A positive number that determines the flex-shrink factor of the flex item. The default value is 1. Negative numbers are invalid.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element flex-shrink property.

Browser Compatibility

The flex-shrink property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 18+ -moz-, 28+
  • Google Chrome 21+ -webkit-, 29+
  • Internet Explorer 11+
  • Apple Safari 6.1+ -webkit-
  • Opera 12.1+

Further Reading

See tutorial on: CSS3 Multi-column Layouts.

Related properties: align-content, align-items, align-self, display, flex, flex-basis, flex-direction, flex-flow, flex-grow, flex-wrap, justify-content, min-height, min-width, order.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties