Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Toggle Icon-bar color change on hover using Bootstrap

I am trying to make the .icon-bar class change color when you hover over it. I got the toggle button to change color and the icon-bar using:

.navbar-preheader .navbar-toggle {
    border: 1px solid white;
    background-color: transparent;
    margin-right: 0;
}

.navbar-preheader .navbar-toggle:hover {
    background-color: #4d4d4d;
}

.navbar-preheader .navbar-toggle .icon-bar {
    background-color: white;
}

The hover code I used was:

.navbar-preheader .navbar-toggle .icon-bar:hover {
    background-color: #4d4d4d;
}

But this is basically making each icon-bar change color, individually (see below), but they should all change color at once...

enter image description hereenter image description here

I am sure it's something silly I am missing, but any help is much appreciated. Thank you.

like image 387
bobbyo23 Avatar asked Sep 06 '14 01:09

bobbyo23


People also ask

How do I change the color of my icon bar?

4. Select the “My Preferences” tab, then click the empty box next to “Switch to colored icons / light background on the Top Icon Bar.” You will see the icon bar change to a light background and the icons will be different colors.


1 Answers

You are wanting to change the background color when hovering over the parent element, therefore the :hover pseudo class should be after .navbar-toggle as opposed to the .icon-bar. In other words, you should use the selector .navbar-toggle:hover .icon-bar.

Example Here

.navbar-preheader .navbar-toggle:hover .icon-bar {
    background-color: #4d4d4d;
}
like image 148
Josh Crozier Avatar answered Oct 26 '22 13:10

Josh Crozier