0

是什么决定了主页按钮左侧和建议按钮右侧的空间?我不希望它在那里,但我不确定如何。

<div class="container">
  <ul class="nav">
    <li class="nav-home">
        <a href="index.html">Home</a>
    </li>
    <li class="nav-games"> 
        <a href="games.html">Games</a>
    </li>
    <li class="nav-chat">
        <a href="chat.html">Chat</a>
    </li>
    <li class="nav-suggestions">
        <a href="suggestions.html">Suggestions</a>
    </li>
  </ul>
</div>

.nav {
width: 900;
clear: right;
height: 55px;
margin-left: 25px;
margin-right: 25px;
z-index: 5;
overflow: visible;
background: #161616; 
background: -moz-linear-gradient(top,  #161616 0%, #282828 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#161616), color-stop(100%,#282828)); 
background: -webkit-linear-gradient(top,  #161616 0%,#282828 100%);
background: -o-linear-gradient(top,  #161616 0%,#282828 100%);
background: -ms-linear-gradient(top,  #161616 0%,#282828 100%); 
background: linear-gradient(to bottom,  #161616 0%,#282828 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#161616', endColorstr='#282828',GradientType=0 );
border: 1px solid #090909;
box-shadow: inset 0px 0px 1px rgba(255,255,255,.2), 0px 3px 5px rgba(0,0,0,.5);
}

.nav li {
list-style-type: none;
float: left;
display: inline-block;
padding: 0px 80px;
padding: 0px 80px\9;
width: 55;
text-align: center;
height: 55px;
border-right: 1px solid #090909;
box-shadow: 1px 0px 0px rgba(255,255,255,.1);
-webkit-transition:all 0.2s linear; 
-moz-transition:all 0.2inear; 
-o-transition:all 1s linear; 
transition:all 0.2s linear; 
}

.nav li.logo:hover { opacity: 1; background-color: transparent;}

.nav li:last-child { border: none; box-shadow: none; }

.nav li a, nav ul li a:visited {
line-height: 55px;
text-decoration: none;
color: #9c9c9c;
font-size: 15px;
font-family: "Droid Sans", Arial, sans-serif;
text-transform: uppercase;
text-shadow: 0px 1px 0px rgba(0,0,0,.9);
-webkit-transition:all 0.2s linear; 
-moz-transition:all 0.2s linear; 
-o-transition:all 0.2s linear; 
transition:all 0.2s linear;     
}

.nav li:hover { 
background-color: rgba(0,0,0,.2); 
background-color: #191919\9; 
-webkit-transition:all 0.2s linear; 
-moz-transition:all 0.2s linear; 
-o-transition:all 0.2s linear; 
transition:all 0.2s linear;
color: white;
}

.nav li:hover a { color: white; 
-webkit-transition:all 0.2s linear; 
-moz-transition:all 0.2s linear; 
-o-transition:all 0.2s linear; 
transition:all 0.2s linear;
}

#nav-home .nav li.nav-home, #nav-home .nav li.nav-home:hover, #nav-home .nav li.nav-home,
#nav-games .nav li.nav-games, #nav-games .nav li.nav-games:hover, #nav-games .nav li.nav-games,
#nav-chat .nav li.nav-chat, #nav-chat .nav li.nav-chat:hover, #nav-chat .nav li.nav-chat,
#nav-comments .nav li.nav-comments, #nav-comments .nav li.nav-comments:hover, #nav-comments .nav li.nav-comments    { 
background: url(../img/tools/pattern.png) top center repeat;
box-shadow: inset 0px 0px 1px rgba(255,255,255,0.5);
}

#nav-home .nav li.nav-home a, #nav-games .nav li.nav-games a, #nav-chat .nav li.nav-chat a, 
#nav-comments .nav li.nav-comments a  { color: white; }

这是 jsfiddle http://jsfiddle.net/DAcgr/所以你可以直观地看到我的意思。如果需要更多信息,请在投票前询问。谢谢

4

2 回答 2

1

列表元素默认有填充。添加padding:0以删除它。

于 2013-03-09T02:03:57.157 回答
0

ul左侧的默认填充

使固定

ul{
    padding:0;
    margin:0;
}
于 2013-03-09T02:05:49.763 回答