CSS: Why “vertical-align: middle” does not work?

前端 未结 8 1063
无人及你
无人及你 2021-02-13 06:24

Consider the following example: (live demo here)

HTML:



        
8条回答
  •  伪装坚强ぢ
    2021-02-13 07:09

    Not sure what's the cause.

    Removing the line-height and adding margins to the image does the trick.

    a {
      display: block;
      background: #f00;
    }
    img {
      margin: .3em auto;
      vertical-align: middle;
    }
    
     
    

提交回复
热议问题