我希望將以下文本和鏈接放在同一行上,文本「由XYZ生成」居中,右側返回頂部鏈接。我究竟做錯了什麼?文本和鏈接不會在同一行上正確對齊
<div id="footer_container">
<span style="text-align: center">Made by XYZ</span>
<span style="float: right"><a href="#top">Return to Top</a></span>
</div>
這裏是div容器代碼:
#footer_container
{
background: #7fc041;
bottom: 0;
height: 1.9em;
left: 0;
position: fixed;
width: 100%;
}
你只能申請['文本align'(http://www.w3.org/TR/CSS21/text.html#alignment-prop )在塊級元素上,所以在'#footer_container'上使用它。 – Adrift
你不需要用span來包裝你的鏈接來浮動它。 –