【发布时间】:2015-09-15 22:50:04
【问题描述】:
我有一个类似于下面代码的 css 语句,当我单击它时,导航栏列表项的底部会显示白色,但是如果我松开鼠标单击,白色边框底部就会消失。当我从一个选项卡单击到另一个选项卡时,我希望在我所在的每个选项卡下都有一个白色的底部。所以它显示了我目前在哪个标签上。这是我的Fiddle
.nav-pills > li > a:active {
border-bottom: 5px solid white;
}
.menupartial {
background-color: #16749F;
opacity: .9;
width: 100%;
}
.menupartial a {
color: lightgrey;
font-weight: bold;
}
.nav-pills > li > a {
border-radius: 0;
}
.nav-pills > li > a:hover {
border-radius: 0;
background-color: #16749F;
color: white;
}
.nav-pills > li > a:active {
border-bottom: 5px solid white;
}
<div class="row menupartial">
<div class="col-md-12">
<ul class="nav nav-pills">
<li>@Html.ActionLink("User", "UserProfile", "Account")</li>
<li>@Html.ActionLink("Profiles", "Index", "Profile")</li>
<li>@Html.ActionLink("Spaces", "Index", "Space")</li>
<li><a href="#">Your Schedules</a>
</li>
<li><a href="#">Your Messages</a>
</li>
<li><a href="#">Your Groups</a>
</li>
<li><a href="#">Your Friends</a>
</li>
</ul>
</div>
</div>
【问题讨论】:
-
您将需要使用 JavaScript/jQuery 来执行此操作。
-
看这里,也许有帮助:stackoverflow.com/questions/12960068/…
-
这可能可以使用纯 css,但我需要更多关于单击链接时发生的其他情况的信息。以下是我之前的几个纯 css/html 答案中的一些选项卡示例:stackoverflow.com/a/30115605/4665 和stackoverflow.com/a/30092724/4665。 Javascript 可能是你最好的选择。
标签: html css twitter-bootstrap