LoginSignup
34
44

More than 5 years have passed since last update.

flexの縦レイアウト

Posted at

上下左右中央寄せ

Demo : https://codepen.io/mo4_9/pen/pdXBmR

スクリーンショット 2017-12-11 10.25.28.png

.item__inner{
  // 縦に積む
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  // 中央寄せ
  justify-content: center;
  align-items: center;
}

縦の比率を維持して伸縮

Demo : https://codepen.io/mo4_9/pen/oorVoY

flex.gif

.wrapper {
  // 1画面に収める
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  // 縦並べ
  display: flex;
  flex-direction: column;
}

.content-1 {
  background: green;
  flex: 3; // 75%
}

.content-2 {
  background: blue;
  flex: 1; // 25%
}
34
44
0

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
34
44