I've created a simple unordered list with rounded corners, when selecting a list item I want the background to become blue to show the active state. 当我没有边界半径时,一切看起来都很棒。
然而,当我使用 4px 的边框半径来圆所有边缘,并选择底部有圆角的最后一个列表项 (#5) 时,蓝色活动状态现在在角上显示小的白色像素。我似乎无法弄清楚如何防止这种情况发生。谢谢你的帮助。.
HTML
<div class="left-dash">
<div class="dash-stats-3">
<ul class="dash-stats-3-ul">
<li><span id="explore-themes">testing</span></li>
<li>
<a href="#" class="tab-link" data-remote="true">
<span class="ss-pika ss-icon">1</span><span class="theme"> test-1</span>
</a>
</li>
<li>
<a href=#"" class="tab-link" data-remote="true">
<span class="ss-pika ss-icon">2</span><span class="theme"> test-2</span>
</a>
</li>
<li>
<a href="" class="tab-link" data-remote="true">
<span class="ss-pika ss-icon">3</span><span class="theme"> test-3</span>
</a>
</li>
<li>
<a href="/theme/inspiring" class="tab-link" data-remote="true">
<span class="ss-pika ss-icon">4</span><span class="theme"> test-4</span>
</a>
</li>
<li>
<a href="#" class="tab-link" data-remote="true">
<span class="ss-pika ss-icon">5</span><span class="theme"> test-5</span>
</a>
</li>
</ul>
</div>
</div>
CSS
.left-dash {
background: #444;
height: 500px;
}
.left-dash div {
-webkit-border-radius: 4px 4px 4px 4px;
border-radius: 4px 4px 4px 4px;
}
.left-dash div ul li:first-child, .left-dash div ul li:first-child a {
-webkit-border-radius: 4px 4px 0px 0px;
border-radius: 4px 4px 0px 0px;
}
.left-dash div ul li:last-child,
.left-dash div ul li:last-child a {
-webkit-border-radius: 0px 0px 4px 4px;
border-radius: 0px 0px 4px 4px;
}
.dash-stats-3 {
width: 220px;
margin-bottom: 17px;
background: #9f9f9f;
-webkit-background-clip: padding-box; /* for transparent border with solid bg - Safari */
background-clip: padding-box;/* for IE9+, Firefox 4+, Opera, Chrome */
border-radius: 0px;
border: 1px solid rgba( 0, 0, 0, 0.15);
box-shadow: inset 0px 0px 2px 0px #FFFFFF,0px 1px 3px 0px rgba(0,0,0, 0.15);
-webkit-box-shadow: inset 0px 0px 2px 0px #FFFFFF,0px 1px 3px 0px rgba(0,0,0, 0.15);
-moz-box-shadow: inset 0px 0px 2px 0px #FFFFFF,0px 1px 3px 0px rgba(0,0,0, 0.15);
-o-box-shadow: inset 0px 0px 2px 0px #FFFFFF,0px 1px 3px 0px rgba(0,0,0, 0.15);
font-family:'Museo Sans W01 700' san-serif;
font-size: 14px;
color: #828282;
text-shadow: 0px 1px 1px #FFFFFF;
font-weight: normal !important;
}
.dash-stats-3 ul li a, .dash-stats-3 ul li:first-child {
height: 41px;
border-bottom: solid rgba( 0, 0, 0, 0.15) 1px;
border-top: solid rgba(255, 255, 255, .65) 1px;
}
.left-dash div ul li:last-child, .left-dash div ul li:last-child a {
border-bottom: none;
}
.dash-stats-3 ul li a {
position:relative;
line-height:43px;
display:block;
}
.dash-stats-3 ul li a.active-tab {
z-index:120;
border-top: 1px solid #5b82a7;
background: #4e81be; /* Old browsers */
}
JS
$(function(){
$('a.tab-link').click(function(){
$('a.tab-link').removeClass('active-tab')
$(this).addClass('active-tab')
});
});