Remove ALL styling/formatting from hyperlinks


I'm creating a navigation menu with words with different colors (href links). I would like the color NOT to change on any state (hover, visited etc).

I know how to set the the colors for the different states, but I would like to know the code to just leave the text color (and any other styling/formatting) as it is.

Any Suggestions?

This question is tagged with html css href

~ Asked on 2012-01-19 00:47:45

The Best Answer is


You can simply define a style for links, which would override a:hover, a:visited etc.:

a {
  color: blue;
  text-decoration: none; /* no underline */

You can also use the inherit value if you want to use attributes from parent styles instead:

body {
  color: blue;
a {
  color: inherit; /* blue colors for links too */
  text-decoration: inherit; /* no underline */

~ Answered on 2012-01-19 00:55:01


As Chris said before me, just an a should override. For example:

a { color:red; }
a:hover { color:blue; }
.nav a { color:green; }

In this instance the .nav a would ALWAYS be green, the :hover wouldn't apply to it.

If there's some other rule affecting it, you COULD use !important, but you shouldn't. It's a bad habit to fall into.

.nav a { color:green !important; } /*I'm a bad person and shouldn't use !important */

Then it'll always be green, irrelevant of any other rule.

~ Answered on 2012-01-19 00:55:40

Most Viewed Questions: