Richard Korts
asked on
CSS Hover Color not working?
I have this code:
This worked perfectly, until I added the Montserrat font, with this in the head scetion
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
Now ALL the links except Profile are in the hover color, profile is white.
That's crazy.
What is wrong?
<style>
a:link { color: white; }
a:hover { color: #8CC6EC; }
</style>
<div class="row hidden-xs">
<div class="col-sm-4 col-xs-4 text-center"> </div>
<div class="col-sm-1 col-xs-1 text-center" style="font-family: 'Montserrat', sans-serif; font-weight: bold; color:white;"><a href="main.php">Home</a></div>
<div class="col-sm-2 col-xs-2 text-center" style="font-family: 'Montserrat', sans-serif; font-weight: bold; color:white;"><a href="choose_proj_sel.php">Saved Items</a></div>
<div class="col-sm-2 col-xs-2 text-center" style="font-family: 'Montserrat', sans-serif; font-weight: bold; color:white;"><a href="http://www.lakos.com/About/contact-us" target="blank">Contact LAKOS</a></div>
<div class="col-sm-2 col-xs-2 text-center" style="font-family: 'Montserrat', sans-serif; font-weight: bold ;color:white;"><a href="profile.php" onClick="return prof_window();">Profile</a></div>
<div class="col-sm-1 col-xs-1 text-left" style="font-family: 'Montserrat', sans-serif; font-weight: bold; color:white;"><a href="logout.php">Logout</a></div>
</div>
This worked perfectly, until I added the Montserrat font, with this in the head scetion
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
Now ALL the links except Profile are in the hover color, profile is white.
That's crazy.
What is wrong?
ASKER
Ok, I did BOTH of what you suggested, removed the font of Montserrat, changed to Arial, cleared the cache in Chrome, still the same with font of Arial, but the font is NOT Arial. See attached image. Impossible!
The code is from view source, so source does not correspond to reality. Impossible!
The code is from view source, so source does not correspond to reality. Impossible!
<style> a:link { color: white!important; } a:hover { color: #8CC6EC; }</style> <div style="background-image: url('https://www.lakoshvac.com/devdev/images/header_new_s.jpg'); text-align: center; height: 115px;">
<div class="row hidden-xs">
<div class="col-sm-4 col-xs-4 text-center"> </div>
<div class="col-sm-1 col-xs-1 text-center" style="font-family: 'Arial', sans-serif; font-weight: bold; "><a href="main.php">Home</a></div>
<div class="col-sm-2 col-xs-2 text-center" style="font-family: 'Arial', sans-serif; font-weight: bold; "><a href="choose_proj_sel.php">Saved Items</a></div>
<div class="col-sm-2 col-xs-2 text-center" style="font-family: 'Arial', sans-serif; font-weight: bold; "><a href="http://www.lakos.com/About/contact-us" target="blank">Contact LAKOS</a></div>
<div class="col-sm-2 col-xs-2 text-center" style="font-family: 'Arial', sans-serif; font-weight: bold ;"><a href="profile.php" onClick="return prof_window();">Profile</a></div>
<div class="col-sm-1 col-xs-1 text-left" style="font-family: 'Arial', sans-serif; font-weight: bold; "><a href="logout.php">Logout</a></div>
</div>
impossible.PNG
ASKER
Does the same in Firefox. Impossible!
Do you have a reference I can look at? There might be other CSS files conflicting with the font choice.
That said, your screenshot looks like Arial to me but Montserrat is a very similar looking font. The giveaway for me is the shape of the lowercase letter a.
That said, your screenshot looks like Arial to me but Montserrat is a very similar looking font. The giveaway for me is the shape of the lowercase letter a.
ASKER
I sent you a message with logon credentials on how to reproduce.
Thanks!
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Oh, so I need to make the visited ones white? I think there is a css for that.
Thanks
Thanks
a:visited
ASKER
Finally got it to work, it would NOT accept hover color until I made it !important.
Thanks for all your work.
Thanks for all your work.
ASKER
Excellent!!
Open in new window
This is always going to override the cascade. Your options are to:
1. remove the style tag's color:white
or
2. add an !important to the end of your CSS. a:hover { color: #8CC6EC !important; }
I highly recommend the former over the latter.
Please see this link for more information about how CSS specificity works https://getflywheel.com/layout/css-specificity-guide/