vertical-align:middle for text in button

后端 未结 2 676
我在风中等你
我在风中等你 2021-02-09 07:09

I have this layout:

\"layout\"

My CSS:

body {
     background: #e2eaed;
}
         


        
相关标签:
2条回答
  • 2021-02-09 07:28

    Another method would be using flexible boxes:

    a {
      display: inline-flex;
      align-items: center; /* cross axis */
      justify-content: center; /* main axis */
    
      line-height: 1; /* reset */
    }
    

    You may need to add prefixes, see browser support and fiddle.

    0 讨论(0)
  • 2021-02-09 07:35

    Vertical align only affects elements that displayed as table cells (or inline blocks, but effect on later is different). Those elements must not be floated.

    a {
      display: table-cell;
      vertical-align: middle;
    
      /* Reset */
      float: none;
      line-height: normal;
    }
    
    0 讨论(0)
提交回复
热议问题