I have made a menu with Bootstrap
and FontAwesome
. I want to change the color of all the social media icons to their original colors. Below is the snippet:
HTML
<nav class="navbar navbar-fixed-top" style="border-top:2px solid #CC0033;border-bottom:2px solid #CC0033;">
<div class="container">
<div class="navbar-header">
<button aria-controls="navbar" aria-expanded="false" data-target="#navbar" data-toggle="collapse" class="navbar-toggle collapsed" type="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!--<div class="navbar-collapse collapse" id="navbar">-->
<div class="navbar-collapse collapse" id="navbar">
<ul class="nav navbar-nav navbar-left">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<li class="dropdown">
<a aria-expanded="true" aria-haspopup="true" role="button" data-toggle="dropdown" class="dropdown-toggle" href="#">Dropdown</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 class="divider" role="separator"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><i class="fa fa-facebook-square social-icon"></i></a></li>
<li><a href="#" class="twitter"><i class="fa fa-twitter-square social-icon"></i></a></li>
<li><a href="#"><i class="fa fa-instagram social-icon"></i></a></li>
<li><a href="#"><i class="fa fa-pinterest-square social-icon"></i></a></li>
<li><a href="#"><i class="fa fa-youtube-square social-icon"></i></a></li>
<li><a href="#"><i class="fa fa-google-plus-square social-icon"></i></a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
CSS
.navbar .navbar-nav > li
{
border: 0px !important;
}
.navbar .navbar-nav > li > a
{
color: #CC0033 !important;
font-family: 'Open Sans', sans-serif;
font-weight: bold;
font-size: 16px;
}
.navbar .navbar-nav > li > a:hover
{
color: #FFFFFF !important;
font-family: 'Open Sans', sans-serif;
font-weight: bold;
font-size: 16px;
background-color: #CC0033 !important;
}
.fa { font-family: 'FontAwesome' !important; }
.social-icon
{
color: #CC0033 !important;
font-size:25px !important;
}
.navbar .navbar-nav > li > a.twitter:hover
{
color: #00ACED !important;
}
Here is a non-working Demo
On hover the icon shall display like this:
For hover I have put the following CSS:
.navbar .navbar-nav > li > a.twitter:hover
{
color: #00ACED !important;
}
How can I achieve the same? Any help will be appreciated.
6
Answers
Just remove the following code:
The
background-color
is over shadowing the color of your font awesome icons, hence they are not visible on hover.Instead if you want to change the color of your font awesome icons on hover use the following code:
EDIT
To change the
background-color
of theli
to white, just remove the following code:If you replace this code:
With this:
Than it should working, good luck!
Simply replace this
by this
and add this
All the best 🙂
You can achieve the desired effect by changing these two lines–
In this way you can change the background-color of li to white.
Hope this helps!
also try this
Add this to your css code:
Works for me that way…