LoginSignup
137
127

More than 3 years have passed since last update.

flexbox早見表

Last updated at Posted at 2016-08-18

いつも検索してたのでメモ。
Container
Items

Container

  flex-direction: row | row-reverse | column | column-reverse;
  flexDirection: 'row' | 'row-reverse' | 'column' | 'column-reverse'
  flex-wrap: nowrap | wrap | wrap-reverse;
  flexWrap: 'nowrap' | 'wrap' | 'wrap-reverse'
  justify-content: flex-start | flex-end | center | space-between | space-around;
  justifyContent: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around'
  align-items: flex-start | flex-end | center | baseline | stretch;
  alignItems: 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch'
  align-content: flex-start | flex-end | center | space-between | space-around | stretch;
  alignContent: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'stretch'

flex-direction

itemsを配置していく方向を指定。

initial: row
row | row-reverse | column | column-reverse

row

flex-direction: row;
flexDirection: 'row',

flex-direction--row.png

row-reverse

flex-direction: row-reverse;
flexDirection: 'row-reverse',

flex-direction--row-reverse.png

column

flex-direction: column;
flexDirection: 'column',

flex-direction--column.png

column-reverse

flex-direction: column-reverse;
flexDirection: 'column-reverse',

flex-direction--column-reverse.png

flex-wrap

itemsの折り返し方を指定。

initial: nowrap
nowrap | wrap | wrap-reverse

nowrap

flex-wrap: nowrap;
flexWrap: 'nowrap',

flex-wrap--nowrap.png

wrap

flex-wrap: wrap;
flexWrap: 'wrap',

flex-wrap--wrap.png

wrap-reverse

flex-wrap: wrap-reverse;
flexWrap: 'wrap-reverse',

flex-wrap--wrap-reverse.png

justify-content

itemsの横方向の整列を指定。

initial: flex-start
flex-start | flex-end | center | space-between | space-around

flex-start

justify-content: flex-start;
justifyContent: 'flex-start',

justify-content--flex-start.png

flex-end

justify-content: flex-end;
justifyContent: 'flex-end',

justify-content--flex-end.png

center

justify-content: center;
justifyContent: 'center',

justify-content--center.png

space-between

justify-content: space-between;
justifyContent: 'space-between',

justify-content--space-between.png

space-around

justify-content: space-around;
justifyContent: 'space-around',

justify-content--space-around.png

align-items

itemsの縦方向の整列を指定。

initial: stretch
flex-start | flex-end | center | baseline | stretch

flex-start

align-items: flex-start;
alignItems: 'flex-start',

align-items--flex-start.png

flex-end

align-items: flex-end;
alignItems: 'flex-end',

align-items--flex-end.png

center

align-items: center;
alignItems: 'center',

align-items--center.png

baseline

align-items: baseline;
alignItems: 'baseline',

align-items--baseline.png

stretch

align-items: stretch;
alignItems: 'stretch',

align-items--stretch.png

align-content

縦方向にitemをどのように配置していくかを指定。

initial: stretch
flex-start | flex-end | center | space-between | space-around | stretch

flex-start

align-content: flex-start;
alignContent: 'flex-start',

align-content--flex-start.png

flex-end

align-content: flex-end;
alignContent: 'flex-end',

align-content--flex-end.png

center

align-content: center;
alignContent: 'center',

align-content--center.png

space-between

align-content: space-between;
alignContent: 'space-between',

align-content--space-between.png

space-around

align-content: space-around;
alignContent: 'space-around',

align-content--space-around.png

stretch

align-content: stretch;
alignContent: 'stretch',

align-content--stretch.png

flex-flow

flex-directionとflex-wrapのショートハンド。
initial: row nowrap

Items

flex-grow: <num>;
flexGrow: <num>,
flex-shrink: <num>;
flexShrink: <num>,
flex-basis: auto | <width>;
flexBasis: 'auto' | <width>,
align-self: auto | flex-start | flex-end | center | baseline | stretch;
alignSelf: 'auto' | 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch',
order: <num>;
order: <num>,

flex-grow

itemsの伸びる倍率。(grow:伸びる、増える、育つ)
1以上を指定するとcontainerいっぱいに広がるように伸びる。
<num>が大きいほど幅が大きくなる。
0はオリジナルの幅。

initial: 0

flex-grow: <num>;
flexGrow: <num>,

flex-grow.png

flex-shrink

itemsの縮む倍率。(shrink:縮む)
containerの幅が縮まる時のitemsの縮む割合を指定できる。
<num>が大きいほど幅が狭くなる。
0はオリジナルの幅。縮まない。

initial: 1

flex-shrink: <num>;
flexShrink: <num>,

flex-shrink.png

flex-basis

flex-itemsは他プロパティで比率が指定されている時、widthプロパティが無視される。
このプロパティを使うと幅を指定出来る。

initial: auto

flex-basis: auto | <width>;
flexBasis: 'auto' | <width>,

flex-basis.png

align-self

align-itemsはcontainerに指定した子要素の縦方向の整列をコントロールするのに対し、align-selfはitems自体に指定して縦方向の整列をコントロールする。

initial: auto

align-self: auto | flex-start | flex-end | center | baseline | stretch;
alignSelf: 'auto' | 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch',

align-self.png

flex(Shorthand)

flex-grow, flex-shrink, flex-basisのショートハンド。

initial: 0 1 auto
initial(flex: 0 1 auto) | auto(flex: 1 1 auto) | none(flex: 0 0 auto)

order

flex-itemsの順番を指定た数字の順番に並べ替える事が出来る。

initial: 0

order: <num>;
order: <num>,

order.png

137
127
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
137
127