html vertical align the text inside input type button

前端 未结 10 2043
抹茶落季
抹茶落季 2021-02-01 00:40

I\'m trying to create a button with height of \'22px\' , and that the text inside the button will be vertically aligned in the center of the button. I tried everything , and can

10条回答
  •  余生分开走
    2021-02-01 01:29

    I was having a similar issue with my button. I included line-height: 0; and it appears to have worked. Also mentioned by @anddero.

    button[type=submit] {
      background-color: #4056A1;
      border-radius: 12px;
      border: 1px solid #4056A1;
      color: white;
      padding: 16px 32px;
      text-decoration: none;
      margin: 2px 1px;
      cursor: pointer;
      display: inline-block;
      font-size: 16px;
      height: 20px;
      line-height: 0;
    }
    

提交回复
热议问题