<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test1</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div style="height: 40px;background: red;">
<span style="font: 12px/40px arial">关注</span>
<img style="width: 24px;height: 24px;display:inline-block;vertical-align:middle;" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg">
</div>
</body>
</html>
1.less 文件
@verticalalign: top;
#test {
border: 1px solid green;
display: inline-block;
padding: 20px;
}
#test0 {
width: 400px;
height: 400px;
border: 1px solid black;
display: inline-block;
vertical-align: @verticalalign;
}
#test1 {
width: 300px;
height: 300px;
border: 1px solid green;
display: inline-block;
vertical-align: @verticalalign;
}
#test2 {
width: 200px;
height: 200px;
border: 1px solid red;
display: inline-block;
vertical-align: @verticalalign;
}