在twitter-bootstrap中更改活动的“nav-pills”颜色

时间:2015-02-27 17:16:08

标签: html css twitter-bootstrap

当我点击导航丸的按钮时,我正试图改变颜色,实际上我想删除这个动作,当我点击时,就像这样:

Img Link:http://i.stack.imgur.com/PuoYX.png (因为我还不能发布图片)

在“流”按钮中,当我点击它时会发生这种情况,但我不希望发生任何事情,或至少改变为与我的悬停动作相同。

HTML:

<div class='navizinha'>

            <ul class="nav nav-pills nav-stacked">
                <li><a href='#'>Início</a></li>
                <li><a href='#'>Inscrição</a></li>
                <li><a href='#'>Stream</a></li>
                <li><a href='#'>Tabela</a></li>
                <li><a href='#'>F.A.Q</a></li>
            </ul>

        </div>

和我的css:

.nav-pills a {
    color: #ffffff
}

.nav-pills a:hover {
    color: #560000;
    border-radius: 0px;
}

.nav-pills .active a:hover {
    color: #560000;
    border-radius: 0px;
}

2 个答案:

答案 0 :(得分:6)

如果我理解正确,您还需要通过CSS定位:focus状态,如下所示:

.nav>li>a:hover,
.nav>li>a:focus {
    text-decoration: none;
    background-color: #560000;
}

<强> Working Example

<强> More about the focus state on CSS-Tricks

答案 1 :(得分:1)

Or you can give this a try

.nav-pills>li.active>a, .nav-pills>li.active>a:hover, .nav-pills>li.active>a:focus{
background-color:yourBgColor;
color:yourLinkColor;
}

From this link