您好在下面的代碼中如何將空間劃分爲所有的iteams列表,並且它應該是中心的。 除了家庭如何劃分3個相等部分如何在html中劃分3個相等部分li
預計產量: 網站首頁|關於|服務
#section ul {
\t width: 1050px;
\t margin: 1px auto 0 auto;
\t height: 50px;
\t padding: 0;
\t float: relative;
\t border-style: solid;
border-width: 1px;
\t background-color: #556B2F;
}
#section ul li {
\t position: relative;
\t list-style-type: none;
display: inline;
}
#section li:before {
\t content: " | ";
}
#section li:first-child:before {
content: none;
}
<div id="section">
\t <ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Service</a></li>
</ul>
</div>
這是我的代碼 – user 2015-02-23 11:57:58
你只是想爲中心的鏈接或做你想讓他們寬度相等嗎?如果只是居中,那麼我會從ul中刪除'float:relative'(相對不是float的有效值),並添加'text-align:center',否則我會去Paulie的解決方案 – Pete 2015-02-23 12:00:57