CSSflex -growプロパティ
例
2番目のフレックスアイテムを残りのアイテムの3倍の幅に拡大します。
div:nth-of-type(1) {flex-grow: 1;}
div:nth-of-type(2) {flex-grow: 3;}
div:nth-of-type(3) {flex-grow: 1;}
定義と使用法
このflex-grow
プロパティは、同じコンテナ内の残りのフレキシブルアイテムと比較してアイテムがどれだけ大きくなるかを指定します。
注:要素がフレキシブルアイテムでない場合、flex-grow
プロパティは効果がありません。
ブラウザのサポート
表の数字は、プロパティを完全にサポートする最初のブラウザバージョンを示しています。
数字の後に-webkit-または-moz-が続く場合は、プレフィックスを使用して機能した最初のバージョンを指定します。
Property | |||||
---|---|---|---|---|---|
flex-grow | 29.0 21.0 -webkit- |
11.0 | 28.0 18.0 -moz- |
9.0 6.1 -webkit- |
17.0 |
CSS構文
flex-grow: number|initial|inherit;
プロパティ値
Value | Description | Play it |
---|---|---|
number | A number specifying how much the item will grow 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 |
関連ページ
CSSチュートリアル:CSSフレキシブルボックス
CSSリファレンス:flexプロパティ
CSSリファレンス:flex-basisプロパティ
CSSリファレンス:flex-directionプロパティ
CSSリファレンス:flex-flowプロパティ
CSSリファレンス:flex-shrinkプロパティ
CSSリファレンス:flex-wrapプロパティ
HTML DOMリファレンス:flexGrowプロパティ