I used Font Awesome for the icon and in the hover it is what I like this resultsenter image description here
and also I have this problem when a link is selected that is what I have enter image description here
I use bootstrap
.nav > li > a:hover
{
background-color: transparent;
}
.iconetwitter
{
color: #ffffff;
width: auto;
height: 33px;
position: relative;
border-radius: 5px;
transition: background-color color 0.2s, font-size 0.2s , ease-in-out;
}
.iconetwitter:hover , .iconetwitter:focus ,.iconetwitter:active
{
color: #1DA1F2;
background-color: white;
}
<ul class="nav">
<li class="contacteicone col-md-3">
<a href="#" class="monicone">
<span class="fa-stack fa-lg">
<i class="fa fa-twitter-square iconetwitter fa-stack-2x"></i>
</span>
</a>
</li>
</ul>
Got it...
The strange hover state is caused by the background color of your font-awesome icons. The background is larger than the character. Correct this with line-height, like this:
.fa {line-height: 0.85em;}
Or use the nicer solution is described here: https://stackoverflow.com/a/27382026/2397550. Then you should use this icon for the underlying square: http://fontawesome.io/icon/square/
The white area behind a focussed icon is because you did this:
.nav > li > a:hover {background-color: transparent;}
This should be:
.nav > li > a:hover, .nav > li > a:focus {background-color: transparent;}
Related
I am styling a navbar using CSS to modify the .navbar-inverse within Bootstrap 3.
My current HTML:
<li class="dropdown">
<a class="dropdown-toggle hvr-glow" data-toggle="dropdown" href="#">My Sites
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>LinkedIn</li>
<li>Github</li>
<li>CodeSandbox</li>
</ul>
I want the to change the color of the link tag that says "My Sites" when I hover over it. Currently, when I hover the link it changes to the same color as the background, which is the color that the other links are supposed to be when hovered over... I do not want to change the hover effect of the other links.
My current CSS for the navbar is:
#banner{
width: 100%;
}
.navbar-brand{
letter-spacing: 3px;
color: #FDFFFC !important;
background-color: #011627 !important;
}
.navbar-brand:hover{
color: #E71D36 !important;
}
.navbar{
background-color: #011627 !important;
border: none !important;
}
.navbar-nav a{
color: #FDFFFC !important;
}
.navbar-nav a:hover{
color: #2EC4B6 !important;
}
.dropdown-menu{
background-color: #FF9F1C !important;
}
.dropdown-menu a:hover{
color: #011627 !important;
background-color: #FF9F1C !important;
}
.dropdown-toggle{
background-color: #2EC4B6 !important;
}
.navbar-inverse .navbar-nav > .active > a:hover{
color: #011627 !important;
}
Picture:
CSS next to my page. I am hovering the link that I cannot target
Try adding this?
.dropdown .dropdown-toggle:hover {
color: red;
}
and obviously change red in the hover to whatever color you want. Also you should only really use !important when its necessary, even for bootstrap where it is used a lot, you seem to be using it a little too much.
So I made am making a website with a lot of links, but I don't like the color changing after you clicked a link, so I added the following properties in my css.
a:link {
text-decoration: none;
color:black;
}
a:visited {
text-decoration: none;
color:black;
}
a:hover {
text-decoration: none;
color:black;
}
a:active {
text-decoration: none;
color:black;
}
a:focus{
text-decoration: none;
}
This works and serves it's purpose, however, my NAV bar uses a switch link, and I need the text to be white. I tried making the specific text in the div white, using the <font color="white> and I tried making all links within my specific div white through css, but nothing seem's to work.
nav code:
<div class="div-right">
<ul style="list-style: none;" class="menu">
<li>
<a href="javascript:;" onclick="changeTab(0)" >Home</a>
<a href="javascript:;" onclick="changeTab(1)" >Projects</a>
</li>
</ul>
You can have a specific CSS to those a tags in the menu.
.div-right > ul > li > a {
color: white;
}
Add more CSS in the same way if you want to hover, visited etc.
Hello guys here is my code to change color on hover. I can change the color of every object except one. -> SPAN_3
<li id="LI_2">
<span id="SPAN_3"></span> <fade>example text</fade>
</li>
.price-box:hover fade {
color: #fff;
}
**.price-box:hover span {
color: #ffffff !important;
}**
I cannot change the color of span. How can I fix this ? I searched the web but couldn't find with a solution.
Here is your issue fixed code
<li id="LI_2">
<span id="SPAN_3"><fade>example text</fade></span>
</li>
#SPAN_3:hover{color:red;}
#SPAN_3{color:#000;}
.price-box:hover fade {
color: #fff;
}
**.price-box:hover span {
color: #ffffff !important;
}**
See its working
li span{
color:red;
}
li:hover span{
color:black
}
<li id="LI_2">
<span id="SPAN_3">text for color change</span> <fade>example text</fade>
</li>
#SPAN_3{ color:#000;}
#LI_2{ color:#000;}
#LI_2:hover{ color:#ff0;}
#LI_2:hover{ color:#000;}
New to Bootstrap and creating a basic navigation bar. I am hoping that what I need makes sense. Put simply, I need the background color and text color of list items in the dropdown-menu to match both before and after they collapse. I cannot seem to find the right CSS attributes to edit, and the many combinations that I have tried do not solve my problem. A similar question did not solve my problem, but perhaps it is worth looking at for others.
Below is what the menu looks like before it collapses. Each <li> has a link, or <a>, within it (see basic HTML below). The text color is black, and the background color is white. When the item is hovered over, the background of <li> turns tan. I want the same colors after the menu collapses:
After collapse it appears like this:
The colors seem to change back to Bootstrap's defaults after collapsing. I would like the text for Sub 1 and Sub 3 to be black by default with a white background, while keeping the color behind the header, Stuff 2, the same. The colors seem to work fine when clicked or hovered over (tan background with black font).
Below is some of the relevant HTML and CSS. I know that some of it is messy (and that the use of !important; is often considered poor form), but I hope someone out there can help me identify the block of code so I can get it working and then focus on cleaning it up.
Basic HTML:
<nav class="navbar navbar-inverse">
<div id="navbarbg" class="container-fluid">
<div id="rbgnavbar" class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a id="logo" class="pull-left" href="http://www.redbuttegarden.org"><img src="images/logo.png" alt="Red Butte Garden"></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="rbgwhitelink">STUFF 1 <span class="caret"></span></span></a>
<ul class="dropdown-menu">
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="rbgwhitelink">STUFF 2 <span class="caret"></span></span></a>
<ul class="dropdown-menu">
<li>Sub 1</li>
<li>Sub 2</li>
<li>Sub 3</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="rbgwhitelink">STUFF 3 <span class="caret"></span></span></a>
<ul class="dropdown-menu">
</ul>
</li>
</ul>
</div>
</div>
</div>
</nav>
Basic CSS:
#rbgnavbar a:hover, a, li, .dropdown-menu li:hover {
color: #000000;
}
.dropdown-menu li:hover {
background-color: #F2EDE4;
color: #000000;
}
/* Main dropdown menu items change cover when selected/clicked */
.dropdown-toggle:active, .open .dropdown-toggle, .dropdown:hover {
background-color: #196143 !important;
}
.dropdown-menu li, .dropdown-menu a {
text-align: center;
color: #000000;
}
.dropdown {
font-size: 10px;
padding: 0;
font-weight: bold;
}
#rbgnavbar {
max-width: 1400px;
margin-left:auto;
margin-right:auto;
background-color:#00502F;
}
.rbgwhitelink {
color: #FFFFFF;
}
.dropdown ul {
padding-top: 0px;
padding-bottom: 0px;
font-size: 10px;
font-weight: bold;
}
/* Border thickness and color between dropdown menu li, padding */
.dropdown-menu li {
border-top: 2px double #D3D3D3;
padding-top: 5px;
padding-bottom: 5px;
}
/* Background color of li in navbar when hovered over */
.dropdown-menu li > a:hover, .dropdown-menu li > a:focus, .dropdown-submenu:hover > a, .dropdown-menu li:hover {
background-color: #F2EDE4;
}
/* Makes dropdown-menu li links bold*/
.dropdown-menu li > a, .dropdown-menu li > a:visited {
font-weight: bold;
}
I suggest to use media queries and add the classes you want to tweak.
For example:
/* Extra Small Devices, Phones */
#media only screen and (min-width : 480px) {
.dropdown-menu>li>a {
background-color: #fff;
}
}
For Bootstrap 3 default media queries you may found it here
After some experimenting, this did it:
.dropdown-menu li {
background-color: #FFFFFF;
}
.dropdown-menu li:hover {
background-color: #F2EDE4;
}
.dropdown-menu li > a:hover {
text-decoration: none;
}
/* Changes the color of link text <a> after navbar has collapsed for small screen or mobile mode */
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a, .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:visited {
color: #000000;
}
I think you have to change this color:
.dropdown-toggle:active, .open .dropdown-toggle, .dropdown:hover {
background-color: #196143 !important;
}
I have the html code something like this:
<li class="sprite-ps2 wishlist">
<a href="/wishlist/">
My Wish
<br>
List
<p>
<i class="fa fa-list-alt fa-3x"></i>
</p>
</a>
</li>
I need to change background of li in blue color and everything inside of them to be color:white on mouse hover on the li element.
See this fiddle, you need to set background blue for li:hover, and li:hover * to be color white
li:hover {
background: blue;
}
li:hover,
li:hover * {
color: #fff;
}
<li class="sprite-ps2 wishlist">
<a href="/wishlist/">
My Wish
<br>
List
<p>
<i class="fa fa-list-alt fa-3x"></i>
</p>
</a>
</li>
Put the following in a <style> element or a .css file:
li:hover {
background-color: blue;
color: white;
}
Because all child elements inside <li> inherit the properties of their parent, they will have a white color (and a blue background too if they don't specify their own).