bootstrap 3 navbar dropdown-toggle not applies all css style











up vote
-1
down vote

favorite












I'm modifing bootstrap 3 navbar and some CSS properties doesn't apply...



I have this navbar HTML:



<nav class="navbar navbar-default">
<div id="navbar-principal" class="container-fluid">

<div id="navbar-colapsado" class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a id="logo" class="navbar-brand" (click)="onClick('Inicio')" [class.active]="'Inicio'===itemSelected" [routerLink]="['/']"><img src="app/img/logo.jpg" alt="Logo"></a>
</div>

<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a [routerLink]="['/link']">Inicio</a></li>

<li role="button" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Info<span class="caret">
</span></a>
<ul class="dropdown-menu">
<li><a [routerLink]="['/linkA']">Mis Compras</a></li>
<li><a [routerLink]="['/linkB']">Mis Facturas</a></li>
<li><a [routerLink]="['/linkC']">Mi Cuenta</a></li>
</ul>
</li>

<li>Other links</li>
<li>Other links</li>
<li>Other links</li>

</ul>
</div><!--/.nav-collapse -->

</div><!--/.container-fluid -->
</nav>


I load bootstrap 3 form CDN and override with this CSS code:



:host .nav.navbar-nav.navbar-right > li.dropdown.open,
.nav.navbar-nav.navbar-right > li.dropdown.open > a,
.nav.navbar-nav.navbar-right > li.dropdown.open > a:hover{
color: yellow;
background-color: rgba(61, 164, 65, 1);
border-color: #999999;
}


My problem is while "color: yellow" is applied, "background-color" is absolutely ignored.



I've inspected computed css in chrome, and seems it is right... but something is overrides my style!



How I must rewrite bootstrap in order to avoid this?










share|improve this question
























  • could you please share the link?
    – Gokulraj Mahadheeraa
    Nov 12 at 12:36










  • The website link? I'm sorry, it's a local develope environment.
    – Max
    Nov 12 at 12:42










  • Can you add related code to generated same issue?
    – Manish Patel
    Nov 12 at 12:59












  • Code provided in the post override the standard bootstrap 3 (load by CDN). By the way, I'm developing an Angular app, because the ":host" selector in CSS.
    – Max
    Nov 12 at 13:03

















up vote
-1
down vote

favorite












I'm modifing bootstrap 3 navbar and some CSS properties doesn't apply...



I have this navbar HTML:



<nav class="navbar navbar-default">
<div id="navbar-principal" class="container-fluid">

<div id="navbar-colapsado" class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a id="logo" class="navbar-brand" (click)="onClick('Inicio')" [class.active]="'Inicio'===itemSelected" [routerLink]="['/']"><img src="app/img/logo.jpg" alt="Logo"></a>
</div>

<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a [routerLink]="['/link']">Inicio</a></li>

<li role="button" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Info<span class="caret">
</span></a>
<ul class="dropdown-menu">
<li><a [routerLink]="['/linkA']">Mis Compras</a></li>
<li><a [routerLink]="['/linkB']">Mis Facturas</a></li>
<li><a [routerLink]="['/linkC']">Mi Cuenta</a></li>
</ul>
</li>

<li>Other links</li>
<li>Other links</li>
<li>Other links</li>

</ul>
</div><!--/.nav-collapse -->

</div><!--/.container-fluid -->
</nav>


I load bootstrap 3 form CDN and override with this CSS code:



:host .nav.navbar-nav.navbar-right > li.dropdown.open,
.nav.navbar-nav.navbar-right > li.dropdown.open > a,
.nav.navbar-nav.navbar-right > li.dropdown.open > a:hover{
color: yellow;
background-color: rgba(61, 164, 65, 1);
border-color: #999999;
}


My problem is while "color: yellow" is applied, "background-color" is absolutely ignored.



I've inspected computed css in chrome, and seems it is right... but something is overrides my style!



How I must rewrite bootstrap in order to avoid this?










share|improve this question
























  • could you please share the link?
    – Gokulraj Mahadheeraa
    Nov 12 at 12:36










  • The website link? I'm sorry, it's a local develope environment.
    – Max
    Nov 12 at 12:42










  • Can you add related code to generated same issue?
    – Manish Patel
    Nov 12 at 12:59












  • Code provided in the post override the standard bootstrap 3 (load by CDN). By the way, I'm developing an Angular app, because the ":host" selector in CSS.
    – Max
    Nov 12 at 13:03















up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I'm modifing bootstrap 3 navbar and some CSS properties doesn't apply...



I have this navbar HTML:



<nav class="navbar navbar-default">
<div id="navbar-principal" class="container-fluid">

<div id="navbar-colapsado" class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a id="logo" class="navbar-brand" (click)="onClick('Inicio')" [class.active]="'Inicio'===itemSelected" [routerLink]="['/']"><img src="app/img/logo.jpg" alt="Logo"></a>
</div>

<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a [routerLink]="['/link']">Inicio</a></li>

<li role="button" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Info<span class="caret">
</span></a>
<ul class="dropdown-menu">
<li><a [routerLink]="['/linkA']">Mis Compras</a></li>
<li><a [routerLink]="['/linkB']">Mis Facturas</a></li>
<li><a [routerLink]="['/linkC']">Mi Cuenta</a></li>
</ul>
</li>

<li>Other links</li>
<li>Other links</li>
<li>Other links</li>

</ul>
</div><!--/.nav-collapse -->

</div><!--/.container-fluid -->
</nav>


I load bootstrap 3 form CDN and override with this CSS code:



:host .nav.navbar-nav.navbar-right > li.dropdown.open,
.nav.navbar-nav.navbar-right > li.dropdown.open > a,
.nav.navbar-nav.navbar-right > li.dropdown.open > a:hover{
color: yellow;
background-color: rgba(61, 164, 65, 1);
border-color: #999999;
}


My problem is while "color: yellow" is applied, "background-color" is absolutely ignored.



I've inspected computed css in chrome, and seems it is right... but something is overrides my style!



How I must rewrite bootstrap in order to avoid this?










share|improve this question















I'm modifing bootstrap 3 navbar and some CSS properties doesn't apply...



I have this navbar HTML:



<nav class="navbar navbar-default">
<div id="navbar-principal" class="container-fluid">

<div id="navbar-colapsado" class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a id="logo" class="navbar-brand" (click)="onClick('Inicio')" [class.active]="'Inicio'===itemSelected" [routerLink]="['/']"><img src="app/img/logo.jpg" alt="Logo"></a>
</div>

<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a [routerLink]="['/link']">Inicio</a></li>

<li role="button" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Info<span class="caret">
</span></a>
<ul class="dropdown-menu">
<li><a [routerLink]="['/linkA']">Mis Compras</a></li>
<li><a [routerLink]="['/linkB']">Mis Facturas</a></li>
<li><a [routerLink]="['/linkC']">Mi Cuenta</a></li>
</ul>
</li>

<li>Other links</li>
<li>Other links</li>
<li>Other links</li>

</ul>
</div><!--/.nav-collapse -->

</div><!--/.container-fluid -->
</nav>


I load bootstrap 3 form CDN and override with this CSS code:



:host .nav.navbar-nav.navbar-right > li.dropdown.open,
.nav.navbar-nav.navbar-right > li.dropdown.open > a,
.nav.navbar-nav.navbar-right > li.dropdown.open > a:hover{
color: yellow;
background-color: rgba(61, 164, 65, 1);
border-color: #999999;
}


My problem is while "color: yellow" is applied, "background-color" is absolutely ignored.



I've inspected computed css in chrome, and seems it is right... but something is overrides my style!



How I must rewrite bootstrap in order to avoid this?







css twitter-bootstrap twitter-bootstrap-3






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 at 13:35

























asked Nov 12 at 12:34









Max

123




123












  • could you please share the link?
    – Gokulraj Mahadheeraa
    Nov 12 at 12:36










  • The website link? I'm sorry, it's a local develope environment.
    – Max
    Nov 12 at 12:42










  • Can you add related code to generated same issue?
    – Manish Patel
    Nov 12 at 12:59












  • Code provided in the post override the standard bootstrap 3 (load by CDN). By the way, I'm developing an Angular app, because the ":host" selector in CSS.
    – Max
    Nov 12 at 13:03




















  • could you please share the link?
    – Gokulraj Mahadheeraa
    Nov 12 at 12:36










  • The website link? I'm sorry, it's a local develope environment.
    – Max
    Nov 12 at 12:42










  • Can you add related code to generated same issue?
    – Manish Patel
    Nov 12 at 12:59












  • Code provided in the post override the standard bootstrap 3 (load by CDN). By the way, I'm developing an Angular app, because the ":host" selector in CSS.
    – Max
    Nov 12 at 13:03


















could you please share the link?
– Gokulraj Mahadheeraa
Nov 12 at 12:36




could you please share the link?
– Gokulraj Mahadheeraa
Nov 12 at 12:36












The website link? I'm sorry, it's a local develope environment.
– Max
Nov 12 at 12:42




The website link? I'm sorry, it's a local develope environment.
– Max
Nov 12 at 12:42












Can you add related code to generated same issue?
– Manish Patel
Nov 12 at 12:59






Can you add related code to generated same issue?
– Manish Patel
Nov 12 at 12:59














Code provided in the post override the standard bootstrap 3 (load by CDN). By the way, I'm developing an Angular app, because the ":host" selector in CSS.
– Max
Nov 12 at 13:03






Code provided in the post override the standard bootstrap 3 (load by CDN). By the way, I'm developing an Angular app, because the ":host" selector in CSS.
– Max
Nov 12 at 13:03














2 Answers
2






active

oldest

votes

















up vote
0
down vote













Just Added Parent class in css to override the default css.



In Below example only right navbar was override by css.






.nav.navbar-nav.navbar-right > li.dropdown.open,
.nav.navbar-nav.navbar-right > li.dropdown.open > a,
.nav.navbar-nav.navbar-right > li.dropdown.open > a:hover{
color: yellow;
background: #3da441;
border-color: #999999;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
<li><a href="#">Link</a></li>
</ul>

<ul class="nav navbar-nav navbar-right">
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>








share|improve this answer























  • Thank you for your answer. I want only override navbar-right element, so this is not a problem. My concern is why "color" atribute is overrided but background-color is not.
    – Max
    Nov 12 at 14:11










  • You need to just overrided background-color with simple background css no need to add background-image css.... updated my answer
    – Manish Patel
    Nov 14 at 6:12












  • Apparently background-image is included in bootstrap 3.3.7 and this was imposed on background-color.
    – Max
    Nov 14 at 8:58


















up vote
0
down vote



accepted










I finally found the problem!



It was because background-image (included in bootstrap) imposed on background-color.



I've fixed adding this code to the component css file:



.navbar-default .navbar-nav > li > .dropdown-menu > li > a:hover,
.navbar-default .navbar-nav > li > .dropdown-menu > li > a:focus {
background-color: rgba(61, 164, 65, 0.1);
background-image: none;
}
.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
background-color: rgba(61, 164, 65, 0.1);
background-image: none;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
background-color: rgba(61, 164, 65, 0.1);
background-image: none;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
background-color: rgba(61, 164, 65, 0.1);
background-image: none;





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53262333%2fbootstrap-3-navbar-dropdown-toggle-not-applies-all-css-style%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Just Added Parent class in css to override the default css.



    In Below example only right navbar was override by css.






    .nav.navbar-nav.navbar-right > li.dropdown.open,
    .nav.navbar-nav.navbar-right > li.dropdown.open > a,
    .nav.navbar-nav.navbar-right > li.dropdown.open > a:hover{
    color: yellow;
    background: #3da441;
    border-color: #999999;
    }

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <nav class="navbar navbar-default">
    <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    </button>
    <a class="navbar-brand" href="#">Brand</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
    <ul class="nav navbar-nav">
    <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
    <li><a href="#">Link</a></li>
    </ul>

    <ul class="nav navbar-nav navbar-right">
    <li><a href="#">Link</a></li>
    <li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
    <ul class="dropdown-menu">
    <li><a href="#">Action</a></li>
    <li><a href="#">Another action</a></li>
    <li><a href="#">Something else here</a></li>
    <li role="separator" class="divider"></li>
    <li><a href="#">Separated link</a></li>
    </ul>
    </li>
    </ul>
    </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
    </nav>








    share|improve this answer























    • Thank you for your answer. I want only override navbar-right element, so this is not a problem. My concern is why "color" atribute is overrided but background-color is not.
      – Max
      Nov 12 at 14:11










    • You need to just overrided background-color with simple background css no need to add background-image css.... updated my answer
      – Manish Patel
      Nov 14 at 6:12












    • Apparently background-image is included in bootstrap 3.3.7 and this was imposed on background-color.
      – Max
      Nov 14 at 8:58















    up vote
    0
    down vote













    Just Added Parent class in css to override the default css.



    In Below example only right navbar was override by css.






    .nav.navbar-nav.navbar-right > li.dropdown.open,
    .nav.navbar-nav.navbar-right > li.dropdown.open > a,
    .nav.navbar-nav.navbar-right > li.dropdown.open > a:hover{
    color: yellow;
    background: #3da441;
    border-color: #999999;
    }

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <nav class="navbar navbar-default">
    <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    </button>
    <a class="navbar-brand" href="#">Brand</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
    <ul class="nav navbar-nav">
    <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
    <li><a href="#">Link</a></li>
    </ul>

    <ul class="nav navbar-nav navbar-right">
    <li><a href="#">Link</a></li>
    <li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
    <ul class="dropdown-menu">
    <li><a href="#">Action</a></li>
    <li><a href="#">Another action</a></li>
    <li><a href="#">Something else here</a></li>
    <li role="separator" class="divider"></li>
    <li><a href="#">Separated link</a></li>
    </ul>
    </li>
    </ul>
    </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
    </nav>








    share|improve this answer























    • Thank you for your answer. I want only override navbar-right element, so this is not a problem. My concern is why "color" atribute is overrided but background-color is not.
      – Max
      Nov 12 at 14:11










    • You need to just overrided background-color with simple background css no need to add background-image css.... updated my answer
      – Manish Patel
      Nov 14 at 6:12












    • Apparently background-image is included in bootstrap 3.3.7 and this was imposed on background-color.
      – Max
      Nov 14 at 8:58













    up vote
    0
    down vote










    up vote
    0
    down vote









    Just Added Parent class in css to override the default css.



    In Below example only right navbar was override by css.






    .nav.navbar-nav.navbar-right > li.dropdown.open,
    .nav.navbar-nav.navbar-right > li.dropdown.open > a,
    .nav.navbar-nav.navbar-right > li.dropdown.open > a:hover{
    color: yellow;
    background: #3da441;
    border-color: #999999;
    }

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <nav class="navbar navbar-default">
    <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    </button>
    <a class="navbar-brand" href="#">Brand</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
    <ul class="nav navbar-nav">
    <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
    <li><a href="#">Link</a></li>
    </ul>

    <ul class="nav navbar-nav navbar-right">
    <li><a href="#">Link</a></li>
    <li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
    <ul class="dropdown-menu">
    <li><a href="#">Action</a></li>
    <li><a href="#">Another action</a></li>
    <li><a href="#">Something else here</a></li>
    <li role="separator" class="divider"></li>
    <li><a href="#">Separated link</a></li>
    </ul>
    </li>
    </ul>
    </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
    </nav>








    share|improve this answer














    Just Added Parent class in css to override the default css.



    In Below example only right navbar was override by css.






    .nav.navbar-nav.navbar-right > li.dropdown.open,
    .nav.navbar-nav.navbar-right > li.dropdown.open > a,
    .nav.navbar-nav.navbar-right > li.dropdown.open > a:hover{
    color: yellow;
    background: #3da441;
    border-color: #999999;
    }

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <nav class="navbar navbar-default">
    <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    </button>
    <a class="navbar-brand" href="#">Brand</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
    <ul class="nav navbar-nav">
    <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
    <li><a href="#">Link</a></li>
    </ul>

    <ul class="nav navbar-nav navbar-right">
    <li><a href="#">Link</a></li>
    <li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
    <ul class="dropdown-menu">
    <li><a href="#">Action</a></li>
    <li><a href="#">Another action</a></li>
    <li><a href="#">Something else here</a></li>
    <li role="separator" class="divider"></li>
    <li><a href="#">Separated link</a></li>
    </ul>
    </li>
    </ul>
    </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
    </nav>








    .nav.navbar-nav.navbar-right > li.dropdown.open,
    .nav.navbar-nav.navbar-right > li.dropdown.open > a,
    .nav.navbar-nav.navbar-right > li.dropdown.open > a:hover{
    color: yellow;
    background: #3da441;
    border-color: #999999;
    }

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <nav class="navbar navbar-default">
    <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    </button>
    <a class="navbar-brand" href="#">Brand</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
    <ul class="nav navbar-nav">
    <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
    <li><a href="#">Link</a></li>
    </ul>

    <ul class="nav navbar-nav navbar-right">
    <li><a href="#">Link</a></li>
    <li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
    <ul class="dropdown-menu">
    <li><a href="#">Action</a></li>
    <li><a href="#">Another action</a></li>
    <li><a href="#">Something else here</a></li>
    <li role="separator" class="divider"></li>
    <li><a href="#">Separated link</a></li>
    </ul>
    </li>
    </ul>
    </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
    </nav>





    .nav.navbar-nav.navbar-right > li.dropdown.open,
    .nav.navbar-nav.navbar-right > li.dropdown.open > a,
    .nav.navbar-nav.navbar-right > li.dropdown.open > a:hover{
    color: yellow;
    background: #3da441;
    border-color: #999999;
    }

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <nav class="navbar navbar-default">
    <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    </button>
    <a class="navbar-brand" href="#">Brand</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
    <ul class="nav navbar-nav">
    <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
    <li><a href="#">Link</a></li>
    </ul>

    <ul class="nav navbar-nav navbar-right">
    <li><a href="#">Link</a></li>
    <li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
    <ul class="dropdown-menu">
    <li><a href="#">Action</a></li>
    <li><a href="#">Another action</a></li>
    <li><a href="#">Something else here</a></li>
    <li role="separator" class="divider"></li>
    <li><a href="#">Separated link</a></li>
    </ul>
    </li>
    </ul>
    </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
    </nav>






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 14 at 6:11

























    answered Nov 12 at 13:13









    Manish Patel

    3,1661721




    3,1661721












    • Thank you for your answer. I want only override navbar-right element, so this is not a problem. My concern is why "color" atribute is overrided but background-color is not.
      – Max
      Nov 12 at 14:11










    • You need to just overrided background-color with simple background css no need to add background-image css.... updated my answer
      – Manish Patel
      Nov 14 at 6:12












    • Apparently background-image is included in bootstrap 3.3.7 and this was imposed on background-color.
      – Max
      Nov 14 at 8:58


















    • Thank you for your answer. I want only override navbar-right element, so this is not a problem. My concern is why "color" atribute is overrided but background-color is not.
      – Max
      Nov 12 at 14:11










    • You need to just overrided background-color with simple background css no need to add background-image css.... updated my answer
      – Manish Patel
      Nov 14 at 6:12












    • Apparently background-image is included in bootstrap 3.3.7 and this was imposed on background-color.
      – Max
      Nov 14 at 8:58
















    Thank you for your answer. I want only override navbar-right element, so this is not a problem. My concern is why "color" atribute is overrided but background-color is not.
    – Max
    Nov 12 at 14:11




    Thank you for your answer. I want only override navbar-right element, so this is not a problem. My concern is why "color" atribute is overrided but background-color is not.
    – Max
    Nov 12 at 14:11












    You need to just overrided background-color with simple background css no need to add background-image css.... updated my answer
    – Manish Patel
    Nov 14 at 6:12






    You need to just overrided background-color with simple background css no need to add background-image css.... updated my answer
    – Manish Patel
    Nov 14 at 6:12














    Apparently background-image is included in bootstrap 3.3.7 and this was imposed on background-color.
    – Max
    Nov 14 at 8:58




    Apparently background-image is included in bootstrap 3.3.7 and this was imposed on background-color.
    – Max
    Nov 14 at 8:58












    up vote
    0
    down vote



    accepted










    I finally found the problem!



    It was because background-image (included in bootstrap) imposed on background-color.



    I've fixed adding this code to the component css file:



    .navbar-default .navbar-nav > li > .dropdown-menu > li > a:hover,
    .navbar-default .navbar-nav > li > .dropdown-menu > li > a:focus {
    background-color: rgba(61, 164, 65, 0.1);
    background-image: none;
    }
    .navbar-default .navbar-nav .open .dropdown-menu > .active > a,
    .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
    .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
    background-color: rgba(61, 164, 65, 0.1);
    background-image: none;
    }
    .navbar-default .navbar-nav > .active > a,
    .navbar-default .navbar-nav > .active > a:hover,
    .navbar-default .navbar-nav > .active > a:focus {
    background-color: rgba(61, 164, 65, 0.1);
    background-image: none;
    }
    .navbar-default .navbar-nav > .open > a,
    .navbar-default .navbar-nav > .open > a:hover,
    .navbar-default .navbar-nav > .open > a:focus {
    background-color: rgba(61, 164, 65, 0.1);
    background-image: none;





    share|improve this answer



























      up vote
      0
      down vote



      accepted










      I finally found the problem!



      It was because background-image (included in bootstrap) imposed on background-color.



      I've fixed adding this code to the component css file:



      .navbar-default .navbar-nav > li > .dropdown-menu > li > a:hover,
      .navbar-default .navbar-nav > li > .dropdown-menu > li > a:focus {
      background-color: rgba(61, 164, 65, 0.1);
      background-image: none;
      }
      .navbar-default .navbar-nav .open .dropdown-menu > .active > a,
      .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
      .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
      background-color: rgba(61, 164, 65, 0.1);
      background-image: none;
      }
      .navbar-default .navbar-nav > .active > a,
      .navbar-default .navbar-nav > .active > a:hover,
      .navbar-default .navbar-nav > .active > a:focus {
      background-color: rgba(61, 164, 65, 0.1);
      background-image: none;
      }
      .navbar-default .navbar-nav > .open > a,
      .navbar-default .navbar-nav > .open > a:hover,
      .navbar-default .navbar-nav > .open > a:focus {
      background-color: rgba(61, 164, 65, 0.1);
      background-image: none;





      share|improve this answer

























        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        I finally found the problem!



        It was because background-image (included in bootstrap) imposed on background-color.



        I've fixed adding this code to the component css file:



        .navbar-default .navbar-nav > li > .dropdown-menu > li > a:hover,
        .navbar-default .navbar-nav > li > .dropdown-menu > li > a:focus {
        background-color: rgba(61, 164, 65, 0.1);
        background-image: none;
        }
        .navbar-default .navbar-nav .open .dropdown-menu > .active > a,
        .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
        .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
        background-color: rgba(61, 164, 65, 0.1);
        background-image: none;
        }
        .navbar-default .navbar-nav > .active > a,
        .navbar-default .navbar-nav > .active > a:hover,
        .navbar-default .navbar-nav > .active > a:focus {
        background-color: rgba(61, 164, 65, 0.1);
        background-image: none;
        }
        .navbar-default .navbar-nav > .open > a,
        .navbar-default .navbar-nav > .open > a:hover,
        .navbar-default .navbar-nav > .open > a:focus {
        background-color: rgba(61, 164, 65, 0.1);
        background-image: none;





        share|improve this answer














        I finally found the problem!



        It was because background-image (included in bootstrap) imposed on background-color.



        I've fixed adding this code to the component css file:



        .navbar-default .navbar-nav > li > .dropdown-menu > li > a:hover,
        .navbar-default .navbar-nav > li > .dropdown-menu > li > a:focus {
        background-color: rgba(61, 164, 65, 0.1);
        background-image: none;
        }
        .navbar-default .navbar-nav .open .dropdown-menu > .active > a,
        .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
        .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
        background-color: rgba(61, 164, 65, 0.1);
        background-image: none;
        }
        .navbar-default .navbar-nav > .active > a,
        .navbar-default .navbar-nav > .active > a:hover,
        .navbar-default .navbar-nav > .active > a:focus {
        background-color: rgba(61, 164, 65, 0.1);
        background-image: none;
        }
        .navbar-default .navbar-nav > .open > a,
        .navbar-default .navbar-nav > .open > a:hover,
        .navbar-default .navbar-nav > .open > a:focus {
        background-color: rgba(61, 164, 65, 0.1);
        background-image: none;






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 14 at 9:00

























        answered Nov 13 at 8:42









        Max

        123




        123






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53262333%2fbootstrap-3-navbar-dropdown-toggle-not-applies-all-css-style%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Guess what letter conforming each word

            Port of Spain

            Run scheduled task as local user group (not BUILTIN)