How to vertically center text next to image?
This question already has an answer here:
You've got vertical-align: top
in there; what you want is vertical-align: middle
, on both the link and the image it's supposed to sit next to.
.section_content {
width: 400px;
}
.section_content > ul > li > img {
width: 40px;
height: 40px;
padding: 5px;
}
.section_content > ul > li > a,
.section_content > ul > li img {
vertical-align: middle;
}
.section_content > ul > li {
list-style-type: none;
}
.section_content > ul {
list-style-type: none;
padding-top: 45px;
padding-left: 5px;
}
<div class="section_content">
<ul>
<li><img src="img/linkedin.svg"><a href="https://be.linkedin.com/in/lel">LinkedIn</a></li>
<li>GitHUb</li>
</ul>
</div>
链接地址: http://www.djcxy.com/p/41524.html
上一篇: CSS:如何在容器中显示文本?
下一篇: 如何垂直居中文字旁边的文字?