LoginSignup
0
0

More than 1 year has passed since last update.

Flexboxで上下左右の中央揃えする方法

Posted at

Flexboxで上下左右の中央揃えする方法

Flexboxで要素を中央揃えする方法です。
親要素に対して、display:flex;を指定し、justify-content:center;で上下の中央揃えをします。
そして、align-items:center;で左右の中央揃えをすると上下左右の中央揃えができます。

style.css

.center {
 height:120px;
 display:flex;
 justify-content:center;
 align-items:center;
}
0
0
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
0
0