最近碰到了这样一个问题,设置line-height属性让文字垂直居中,,发现在ios端是居中的,但是在Android上总是发现文字偏上,具体代码如下。
//css
a{
font-size: 13px;
width: 70px;
background-color: #00AEFF;
line-height: 23px;
margin-right: 10px;
display: inline-block;
color: white;
text-align: center;
border-radius: 4px;
}
//html
<div>
<a>图文咨询</a>
<a>电话咨询</a>
<a>名医到家</a>
</div>
安卓和ios效果图如下

产生原因
据说是line-height对一部分Android手机不起作用,有自己默认的行高,默认行高为22px
怎么解决
line-height:normal;
padding:10px 0;
网友评论