我想要使用相對位置值將這兩個元素並排完全對齊。我很難理解爲什麼這兩個元素不想對齊。我不明白爲什麼這兩個元素沒有並排排列?
有人可以解釋我做錯了什麼嗎?如果可能的話找到解決方案?
https://jsfiddle.net/kerberonix/qcq68gfg/
HTML
<html>
<body>
<footer>
<div class="test">
<p>Footer Text</p>
</div>
<ul class="social-links">
<li>Link 1</li>
<li>Link 2</li>
</ul>
</footer>
</body>
CSS
footer {
position: absolute;
bottom: 0;
width: 100%;
height: 70px;
padding: 0 20px;
background-color: #262626;
}
.test {
position: relative;
display: inline-block;
top: 50%;
width: 50%;
transform: translateY(-50%);
}
footer p {
font-size: 100%;
color: #888;
}
.social-links {
position: relative;
display: inline-block;
top: 50%;
width: 50%;
transform: translateY(-50%);
}
.social-links li {
display: inline-block;
margin-right: 35px;
text-decoration: none;
}
.social-links li:last-child {
margin: 0;
}
代碼這就是你」重新去? https://jsfiddle.net/qcq68gfg/6/ –
我試圖讓它與「頁腳文本」在右側完全相同的位置垂直對齊。 – kerberonix
是這樣的:|頁腳文本_______________鏈接1鏈接2 | – kerberonix