LoginSignup
0
1

More than 3 years have passed since last update.

ボタンの中のテキストを中心にする方法

Last updated at Posted at 2020-10-18
.testbutton {
  display: inline-flex;
  align-items: center; 
 justify-content: space-around;
}

2行以上のテキストをDIVの中にvertical中心にするときは

display: flex;
    justify-content: center;
    align-content: center;
    flex-direction: column;

また、下記はzerosixthreeからのもので、6行のCSSで何でも中央に配置できます

p {
  text-align: center;
  position: relative;
  top: 50%;
  -ms-transform: translateY(-50%);
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
}
0
1
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
1