Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 64
  • Last Modified:

CSS anchor colors do not seem to be affected the link

I had this question after viewing The Menu is good, but needs a couple of Tweaks.

I added these two CSS rules:

.sub-menu-item > a:hover {
      color:red;
}

.sub-menu-item > a:link {
      color:black;
}

The color of the link does indeed show the text black,  but on hovering,  the color of the text doesn't change to red.
0
Howard Bash
Asked:
Howard Bash
  • 2
1 Solution
 
Kim WalkerWeb Programmer/TechnicianCommented:
You may have a more specific style that is taking precedence. Can you post a link to the live page?
0
 
JasonFreelance Computer TechnicianCommented:
You can try this...
.sub-menu-item > a:hover {
      color:red !important;
}

Open in new window

The !important means it will override any style that has precedence and use this rule instead, but it would help to have a link to the website so we can see all the code.
0
 
Howard BashSenior Software EngineerAuthor Commented:
Hi,

I added the !important and it works.  Not sure what is colliding with it.  But that works for me.  Thank you sir.
0
 
Howard BashSenior Software EngineerAuthor Commented:
Worked as required.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now