废话不多说 上代码

HTML结构

 <div id="imgwrap">
       <img src="http://jiedemo.sinaapp.com/img/240.jpg">
       <span></span>
    </div>

CSS

 

   #imgwrap{ 
       width:300px;
       height:400px;
       background:#f00;
       line-height: 400px;
       text-align: center;
   }
   #imgwrap img {vertical-align: middle;}
   #imgwrap span{ display:inline-block;}

 

点击这里查看DEMO

以上是hasylayout官网给出的解决方案 原文:http://haslayout.net/css/No-line-height-Vertical-Center-on-Images-Bug

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2021-08-07
  • 2021-12-05
  • 2021-12-04
  • 2022-12-23
猜你喜欢
  • 2021-12-05
  • 2021-08-26
  • 2022-12-23
  • 2021-07-06
相关资源
相似解决方案