在瀏覽互聯網一段時間後,我還沒有找到一種方法來成功地在我的頁面上排列一個無序列表。無法將頁面中的無序列表居中?
下面是列表中的HTML:
<div id="buttons">
<ul>
<li><a href="http://www.twitter.com/tommaxwelll"><img src="twitter.png" alt="twitter-icon" /></a></li>
<li><a href="http://www.github.com/tommaxwell"><img src="github.png" alt="github-icon" /></a></li>
<li><a href="http://www.instagram.com/tommaxwelll"><img src="instagram.png" alt="instagram-icon" /></a></li>
<li><a href="http://www.facebook.com/tommaxwelll"><img src="facebook.png" alt="facebook-icon" /></a></li>
</ul>
</div>
而這裏的CSS的建議,其他SO帖子:
#buttons {
float: right;
position: relative;
left: -50%;
top:140px;
text-align: left;
}
#buttons ul {
list-style-type: none;
position: relative;
left: 50%;
}
#buttons li {
float: left;
position: relative;
}
的浮動:留在列表中的項目是我如何保持列表橫向。您還可以在問題查看網站在這裏:http://www.tommaxwell.me
我看不出有什麼問題... 怎麼了?請提供關於瀏覽器和系統的信息。我使用鉻和按鈕很好地集中在文本下;)順便說一句。你究竟想達到什麼目的?我不知道你想要什麼 – Vogel612
有什麼問題? Coz on site我得到正確的中心對齊列表 – codeomnitrix
你的意思是你希望周圍的容器'#按鈕'集中在頁面內嗎? – Ohgodwhy