我正在尝试在我的页脚中添加共享功能。但是,图标(具有指向IG的链接)显示在h5下方。如何让图标和h5在同一行上?
这是我的HTML和CSS:
footer {
background-color: black;
line-height: 100px;
height: 100px;
border-top: 2px solid #f28600;
text-align: center;
}
footer h5 {
color: white;
font-size: 16px;
}
footer a img {
height: 25%
}<footer>
<h5> © 2019 The Novel Column </h4>
<a href="http://www.instagram.com"> <img src="https://cdn4.iconfinder.com/data/icons/social-messaging-ui-color-shapes-2-free/128/social-instagram-new-circle-512.png"> </a>
</footer>
提前感谢您的帮助!
发布于 2019-06-17 01:00:53
使用适当的display:flex,您可以将两个元素放在同一行上。
footer {
background-color: black;
line-height: 100px;
height: 100px;
border-top: 2px solid #f28600;
text-align: center;
display: flex;
align-items: baseline;
}
footer h5 {
color: white;
font-size: 16px;
}<footer>
<h5> © 2019 The Novel Column </h4>
<a href="http://www.instagram.com">
<img src="https://cdn4.iconfinder.com/data/icons/social-messaging-ui-color-shapes-2-free/128/social-instagram-new-circle-512.png" width="20px"> </a>
</footer>
你可以根据你想要做的事情来使用适当的justify-content。

参考文献
https://stackoverflow.com/questions/56620827
复制相似问题