LoginSignup
0
0

More than 3 years have passed since last update.

子要素を親要素の中央に設置する方法【CSS】

Posted at

子要素を親要素の上下左右で中央寄せする方法【CSS】

参考リンク:子要素を親要素内で上下左右中央寄せさせる方法

css
.parent{
  position: relative;
}

.child{
  position:absolute;
  top:50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

こうすることで親要素の中にある子要素を親要素の中央に設置することができた。

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