这个图和文字没有水平对齐 我想让它们水平对齐 但是我调sp2的margin-top或者line-height的时候这个图片也一直跟着移动 这是为什么?那么怎么调整才能让这两个水平对齐呢?
下面是这个图片 大家可以试一下
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="./iconfont.css">
<title></title>
<style type="text/css">
#div1{width: 200px;height: 40px;}
#sp1{width: 20px;height: 20px;display: inline-block;}
#sp1 img{width: 100%;height: 100%}
#sp2{height: 20px;display: inline-block;}
</style>
</head>
<body>
<div id="div1">
<span id="sp1"><img src="sousuo.png"></span>
<span id="sp2">搜索</span>
</div>
</body>
</html>
给sp1,sp2都加vertical-align: middle就可以了