所以我有这样的设计:
我的HTML:
<div id="tabs-profile">
<ul class="nav nav-pills uppercase bold">
<li class="active"><a data-toggle="pill" href="#portfolio">portfolio</a></li>
<li><a data-toggle="pill" href="#info">info</a></li>
<li><a data-toggle="pill" href="#recommendation">recommendation</a></li>
</ul>
</div><!-- tabs-profile -->
我的css:
.nav-pills>li>a{
padding: 10px 35px;
border-radius: 0;
color: #fff;}
.nav-pills{
padding: 5px 0 0;
background-color: #f8e713;}
问题:
如何在活跃时li
结束前制作具有背景色的最后navpills
?
答案 0 :(得分:0)
.last-child
处于有效状态时,请添加li
课程。
.nav-pills>li>a {
padding: 10px 35px;
border-radius: 0;
color: #fff;
}
.nav-pills {
padding: 5px 0 0;
background-color: #f8e713;
display: block;
float: left;
width: 100%;
}
.nav-pills>li {
float: left;
list-style:none;
}
.nav-pills>li.last-child {
background-color: #fff;
float: none;
overflow: hidden;
}
.nav-pills>li.last-child a {
color: #333;
}
&#13;
<div id="tabs-profile">
<ul class="nav nav-pills uppercase bold">
<li class="active"><a data-toggle="pill" href="#portfolio">portfolio</a></li>
<li><a data-toggle="pill" href="#info">info</a></li>
<li class="last-child"><a data-toggle="pill" href="#recommendation">recommendation</a></li>
</ul>
</div>
<!-- tabs-profile -->
&#13;