Skip to content
中文

Eliminate the gap at the bottom of the image ​

TIP

通过设置给 img 元素设置 vertical-align: top 消除行内元素的间隙(仅对 img 元素有用)

baseline
css

Middle text and image ​

安能摧眉折腰事权贵,使我不得开心颜
html
<div class="container">
  <img src="../../public/images/bg1.jpg">
  <span>安能摧眉折腰事权贵,使我不得开心颜</span>
</div>
scss
.container{
  padding:15px 0;
  img{
    vertical-align: middle;
  }
}
Read or leave comments on GitHub