Remove ALL styling/formatting from hyperlinks

后端 未结 4 1929
有刺的猬
有刺的猬 2020-12-22 18:26

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

4条回答
  •  情书的邮戳
    2020-12-22 19:27

    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.

提交回复
热议问题