How to change menu colors?

Asked

Viewed 46,906 times

-3

When we create a menu with Bootstrap, it by default, creates a black band throughout the menu area. It looks beautiful like this. However, in the company I’m in, the predominant color is magenta, so I was asked to change this color from black to magenta.

How can I change that?

  • what was the reason for the downvote? What was wrong this time?

  • Inspect the widget from your browser and see which class you can change the color in

  • 3

    the downvote may be by the question "do not present any effort in the research", I say

  • Dude, you need to put a link here, or maybe the HTML in question. How do we know exactly what it’s about? navbar. http://stackoverflow.com/questions/18529274/change-navbar-color-in-twitter-bootstrap-3

  • What kind of menu are you talking about?

  • 10 seconds on google - "change bootstrap Colors" and the first link is: http://www.lavishbootstrap.com/

  • Miguel, by the navigator’s inspector I find the guy, but I can’t locate him on my project to make the change, you know. There in the browser I have: bootstrap.Less:4013.Only I don’t find this guy there. By the browser I edit, but I need to do this in the project now.

  • Because then in your project you have to go to the css file and change the properties. It should be in Content > bootstrap. You need to change the bootstrap.css file and bootstrap.min.css. Or the div of the metes menu right away style=" defines o estilo aqui"

  • I got char. In the browser the color is like: #22222 and the code was like:@navbar-inverse-bg. So I got it, but I already solved it.

  • How do people know that there was no effort? I find this very malicious. As I said I was getting beat up, because I see one thing and in the other code. All right, I’ll remove the question.

  • 2
  • 1

    Actually I find the question very good and relevant, I do not understand the negative votes.

Show 7 more comments

1 answer

16

You can change the CSS classes or use tools such as Lavish or Twbscolor.

And I found the following question from Soen which is very complete and didactic. I transcribe and translate the user response here zessx:

Navbars available

There are 2 types of navbar :

<!-- A clara -->
<nav class="navbar navbar-default" role="navigation"></nav>
<!-- A escura -->
<nav class="navbar navbar-inverse" role="navigation"></nav>

Using the standard colors

These are the standard colors and what they’re for :

  • #F8F8F8 : background navbar
  • #E7E7E7 : navbar border
  • #777 : default color
  • #333 : Hover color (#5E5E5E for .nav-brand)
  • #555 : active color
  • #D5D5D5 : active background

Standard Style

If you want to change something in style, this is the CSS you need to change :

/* navbar */
.navbar-default {
    background-color: #F8F8F8;
    border-color: #E7E7E7;
}
/* title */
.navbar-default .navbar-brand {
    color: #777;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
    color: #5E5E5E;
}
/* link */
.navbar-default .navbar-nav > li > a {
    color: #777;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
    color: #333;
}
.navbar-default .navbar-nav > .active > a, 
.navbar-default .navbar-nav > .active > a:hover, 
.navbar-default .navbar-nav > .active > a:focus {
    color: #555;
    background-color: #E7E7E7;
}
.navbar-default .navbar-nav > .open > a, 
.navbar-default .navbar-nav > .open > a:hover, 
.navbar-default .navbar-nav > .open > a:focus {
    color: #555;
    background-color: #D5D5D5;
}
/* caret */
.navbar-default .navbar-nav > .dropdown > a .caret {
    border-top-color: #777;
    border-bottom-color: #777;
}
.navbar-default .navbar-nav > .dropdown > a:hover .caret,
.navbar-default .navbar-nav > .dropdown > a:focus .caret {
    border-top-color: #333;
    border-bottom-color: #333;
}
.navbar-default .navbar-nav > .open > a .caret, 
.navbar-default .navbar-nav > .open > a:hover .caret, 
.navbar-default .navbar-nav > .open > a:focus .caret {
    border-top-color: #555;
    border-bottom-color: #555;
}
/* mobile version */
.navbar-default .navbar-toggle {
    border-color: #DDD;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
    background-color: #DDD;
}
.navbar-default .navbar-toggle .icon-bar {
  background-color: #CCC;
}
@media (max-width: 767px) {
  .navbar-default .navbar-nav .open .dropdown-menu > li > a {
      color: #777;
    }
  .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
  .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
          color: #333;
    }
}

Examples of navbar with custom colors

Here are 4 navbar shampoos with different colors:
Jsfiddle link

enter image description here

And the SCSS code :

$bgDefault        : #e74c3c;
$bgHighlight  : #c0392b;
$colDefault   : #ecf0f1;
$colHover         : #ffbbbc;
.navbar-default {
  background-color: $bgDefault;
  border-color: $bgHighlight;
  .navbar-brand {
    color: $colDefault;
    &:hover, &:focus { 
      color: $colHighlight; }}
  .navbar-text {
    color: $colDefault; }
  .navbar-nav {
    > li {
      > a {
        color: $colDefault;
        &:hover,  &:focus {
          color: $colHighlight; }}}
    > .active {
      > a, > a:hover, > a:focus {
        color: $colHighlight;
        background-color: $bgHighlight; }}
    > .open {
      > a, > a:hover, > a:focus {
        color: $colHighlight;
        background-color: $bgHighlight; }}}
  .navbar-toggle {
    border-color: $bgHighlight;
    &:hover, &:focus {
      background-color: $bgHighlight; }
    .icon-bar {
      background-color: $colDefault; }}
  .navbar-collapse,
  .navbar-form {
    border-color: $colDefault; }
  .navbar-link {
    color: $colDefault;
    &:hover {
      color: $colHighlight; }}}
@media (max-width: 767px) {
  .navbar-default .navbar-nav .open .dropdown-menu {
    > li > a {
      color: $colDefault;
      &:hover, &:focus {
        color: $colHighlight; }}
    > .active {
      > a, > a:hover, > a:focus, {
        color: $colHighlight;
        background-color: $bgHighlight; }}}
}

And finally, a little present

I created a small script that allows you to generate your theme :
Twbscolor - Generate your Own Bootstrap navbar

[Update] : Twbscolor now generates SCSS/SASS/LESS/CSS code.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.