我不能讓這個導航欄居中。請幫忙。如何集中響應導航欄
這裏是我的html:
<div class="nav">
<ul id="menu">
<li><a href="home.html">Home</a></li>
<li><a href="latestnews.html">Latest News</a></li>
<li><a href="resultsevents.html">Results & Events</a></li>
<li><a href="fundraising.html">Fundraising</a></li>
<li><a href="gallery.html">Gallery</a></li>
</ul>
</div>
這裏是我的CSS:
#nav {
margin:0px auto; }
ul {
display: inline-block;
list-style-type:none;
margin:0 auto;
padding:0;
position: absolute; }
li {
display:inline;
float: left;
margin-right: 1px; }
li a {
display:inline-block;
min-width:140px;
height: 50px;
text-align: center;
line-height: 50px;
font-family: Century Gothic, Candara, Tahoma, sans-serif;
color: #fff;
background: #2f3036;
text-decoration: none; }
li:hover a {
background: #659d32; }
li:hover ul a {
background: #f3f3f3;
color: #2f3036;
height: 40px;
line-height: 40px; }
li:hover ul a:hover {
background: #659d32;
color: #fff; }
li ul {
display: none; }
li ul li {
display: block;
float: none; }
li ul li a {
width: auto;
min-width: 100px;
padding: 0 20px; }
ul li a:hover + .hidden, .hidden:hover {
display: block; }
.show-menu {
font-family: Century Gothic, Candara, Tahoma, sans-serif;
text-decoration: none;
color: #fff;
background: #659d32;
text-align: center;
padding: 10px 0;
display: none; }
input[type=checkbox]{
display: none; }
input[type=checkbox]:checked ~ #menu{
display: block; }
@media screen and (max-width : 760px){
ul {
position: static;
display: none;
}
li {
margin-bottom: 1px;
}
ul li, li a {
width: 100%;
}
.show-menu {
display:block;
}
}
我嘗試添加圍繞整個事情股利和保證金設置爲自動但處理不當的工作。林不知道該怎麼做。
請加[小提琴](https://jsfiddle.net/),所以我們可以看到的問題是什麼。 – 2015-04-01 20:44:43