我的 TikTok 徽標沒有顯示在標題中,也沒有與名稱對齊。我該如何解決?在此先感謝您的幫助。

HTML :
<div class="header">
<h2 class="name">Name</h2>
<a class="social-icon-header" href="https://www.tiktok.com/@xxx" target="_blank">
<img class="tiktok" src="images/TikTok-Icon-Logo.wine.svg">
</a>
</div>
CSS:
.name {
font-size: 250%;
padding-top: 1%;
}
/* Social Icon */
.tiktok {
width: 4em;
height: auto;
position: relative;
float: right;
}
uj5u.com熱心網友回復:
您正在使用相互沖突的浮動和相對位置。嘗試洗掉 tiktock 元素中的兩個。并嘗試使用 align-items 在父容器上進行 flex。
.header {
display: flex;
align-items: center;
justify-content: space-between;
}
.name {
font-size: 250%;
}
/* Social Icon */
.tiktok {
width: 4em;
height: auto;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/344706.html
上一篇:網格區域不適應容器高度
