文字和字体图表连写,即使设置了行高等于高度,图片也会稍微往下沉一些,下边这种方法可以实现。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
.test-view {
border: 1px solid black;
height: 60px;
line-height: 60px;
}
.test-view .dot {
display: inline-block;
width: 20px;
height: 20px;
vertical-align: middle;
background: url(images/security.png);
background-size: 100% 100%;
}
.test-view .text {
vertical-align: middle;
font-size: 20px;
}
.test-view.case3 {
font-size: 0;
}
</style>
</head>
<body>
<div class="test-view case3">
<span class="text">查看详情</span>
<i class="dot"></i>
</div>
<!-- <img src="images/security.png" alt=""> -->
</body>
</html>