我有ul
一个 1px 的左边框和一个 2px 的li
子边框。问题是我想在每个li
元素的底部边框之间保留 1px 空间。这是它目前的样子:
我希望它看起来如何:
如您所见,一旦border-left
结束,border-bottom
继续并填充 1px 的间隙。有没有办法防止这种情况?
这是相关的HTML:
<div id="mainNav">
<ul>
<li>
<a href="#" class="mainNavLink">Leaderboards</a>
</li>
<li>
<a href="#" class="mainNavLink">Statistics</a>
</li>
<li id="mainNavSearch">Search</li>
</ul>
</div>
和CSS:
#mainNav{
width: 100%;
height: 35px;
background-color: #202020;
border-bottom: 1px solid #444;
position: relative;
overflow: hidden;
}
#mainNav ul{
width: 960px;
height: 35px;
margin: 0 auto 0 auto;
display: block;
position: relative;
}
#mainNav ul li{
float: left;
position: relative;
height: 25px;
padding: 10px;
padding-top: 8px;
padding-bottom: 0;
font-size: 17px;
border-left: 1px solid #444;
border-bottom: 2px solid #00a4ff;
background: -moz-linear-gradient(top, rgba(24,24,24,0) 60%, rgba(24,24,24,0.38) 90%, rgba(0,0,0,0.5) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(60%,rgba(24,24,24,0)), color-stop(90%,rgba(24,24,24,0.38)), color-stop(100%,rgba(0,0,0,0.5)));
background: -webkit-linear-gradient(top, rgba(24,24,24,0) 60%,rgba(24,24,24,0.38) 90%,rgba(0,0,0,0.5) 100%);
background: -o-linear-gradient(top, rgba(24,24,24,0) 60%,rgba(24,24,24,0.38) 90%,rgba(0,0,0,0.5) 100%);
background: -ms-linear-gradient(top, rgba(24,24,24,0) 60%,rgba(24,24,24,0.38) 90%,rgba(0,0,0,0.5) 100%);
background: linear-gradient(to bottom, rgba(24,24,24,0) 60%,rgba(24,24,24,0.38) 90%,rgba(0,0,0,0.5) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00181818', endColorstr='#80000000',GradientType=0 );
}
#mainNavSearch{
border-right: 1px solid #444;
}