box-flex-group CSS property

Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Warning: This is a property of the original CSS flexible box layout Module draft. It has been replaced in the specification. See flexbox for information about the current standard.

The box-flex-group CSS property assigns the flexbox's child elements to a flex group.

For flexible elements assigned to flex groups, the first flex group is 1 and higher values specify subsequent flex groups. The initial value is 1. When dividing up the box's extra space, the browser first considers all elements within the first flex group. Each element within that group is given extra space based on the ratio of that element's flexibility compared to the flexibility of other elements within the same flex group. If the space of all flexible children within the group has been increased to the maximum, the process repeats for the children within the next flex group, using any space left over from the previous flex group. Once there are no more flex groups, and there is still space remaining, the extra space is divided within the containing box according to the box-pack property.

If the box would overflow after the preferred space of the children has been computed, then space is removed from flexible elements in a manner similar to that used when adding extra space. Each flex group is examined in turn and space is removed according to the ratio of the flexibility of each element. Elements do not shrink below their minimum widths.

Syntax

css
/* <integer> values */
box-flex-group: 1;
box-flex-group: 5;

/* Global values */
box-flex-group: inherit;
box-flex-group: initial;
box-flex-group: unset;

The box-flex-group property is specified as any positive <integer>.

Formal definition

Initial value1
Applies toin-flow children of box elements
Inheritedno
Computed valueas specified
Animation typediscrete

Formal syntax

box-flex-group = 
<integer>

<integer> =
<number-token>

Examples

Basic usage example

In the original flexbox spec, box-flex-group could be used to assign flex children to different groups to distribute flexible space between:

css
article:nth-child(1) {
  -webkit-box-flex-group: 1;
}

article:nth-child(2) {
  -webkit-box-flex-group: 2;
}

This was only ever supported in WebKit-based browsers, with a prefix, and in subsequent versions of the spec this functionality does not have an equivalent. Instead, distribution of space inside the flex container is now handled using flex-basis, flex-grow, and flex-shrink.

Specifications

Not part of any standard.

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
box-flex-group
Deprecated Non-standard
Chrome – No support
Chrome 1 – 66 (Release date: 2008-12-11)
prefix
footnote Removed in 67 and later
prefix Implemented with the vendor prefix: -webkit-
Edge – No support
Edge
footnote No support
Firefox – No support
Firefox
footnote No support
Opera – No support
Opera 15 – 53 (Release date: 2013-07-02)
prefix
footnote Removed in 54 and later
prefix Implemented with the vendor prefix: -webkit-
Safari – No support
Safari 1.1 – 2 (Release date: 2003-10-24)
prefix
prefix Implemented with the vendor prefix: -khtml-
Safari – Full support
Safari 3 (Release date: 2007-10-26)
prefix
prefix Implemented with the vendor prefix: -webkit-
Chrome Android – No support
Chrome Android 18 – 66 (Release date: 2012-06-27)
prefix
footnote Removed in 67 and later
prefix Implemented with the vendor prefix: -webkit-
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android 14 – 47 (Release date: 2013-05-21)
prefix
footnote Removed in 48 and later
prefix Implemented with the vendor prefix: -webkit-
Safari on iOS – Full support
Safari on iOS 1 (Release date: 2007-06-29)
prefix
prefix Implemented with the vendor prefix: -webkit-
Samsung Internet – No support
Samsung Internet 1 – 8.2 (Release date: 2013-04-27)
prefix
footnote Removed in 9 and later
prefix Implemented with the vendor prefix: -webkit-
WebView Android – No support
WebView Android 4.4 – 66 (Release date: 2013-12-09)
prefix
footnote Removed in 67 and later
prefix Implemented with the vendor prefix: -webkit-
WebView on iOS – Full support
WebView on iOS 1 (Release date: 2007-06-29)
prefix
prefix Implemented with the vendor prefix: -webkit-

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.
Requires a vendor prefix or different name for use.
Has more compatibility info.

See also