How to remove the default link color of the html h

2019-01-21 02:13发布

The default link color is blue. How to remove the default link color of the html hyperlink tag <a>?

10条回答
啃猪蹄的小仙女
2楼-- · 2019-01-21 02:14

This is also possible:

        a {
            all: unset;
        }

unset: This keyword indicates to change all the properties applying to the element or the element's parent to their parent value if they are inheritable or to their initial value if not. unicode-bidi and direction values are not affected.

Source: Mozilla description of all

查看更多
老娘就宠你
3楼-- · 2019-01-21 02:15

Simply add this in CSS,

a {
    color: inherit;
    text-decoration: none;
}

that's it, done.

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-01-21 02:18

You can use System Color (18.2) values, introduced with CSS 2.0, but deprecated in CSS 3.

a:link, a:hover, a:active { color: WindowText; }

That way your anchor links will have the same color as normal document text on this system.

查看更多
Explosion°爆炸
5楼-- · 2019-01-21 02:19

Let's say your default color is green (#0F0), then you should add this to the top of your CSS:

a {color:#0F0}

查看更多
小情绪 Triste *
6楼-- · 2019-01-21 02:22

If you don't want to see the text decoration and default color which is provided by the browser, you can keep the following code in the top of your main.css file. So if you need some different color & decoration styling property you can override easily in the below of this code snippet in the style file.

 a:hover, a:focus, a:active {
      text-decoration: none;
      color: inherit;
 }
查看更多
我想做一个坏孩纸
7楼-- · 2019-01-21 02:28

The inherit property:

a { color: inherit; } 

… will cause the element to take on the colour of its parent (which is what I think you are looking for).

查看更多
登录 后发表回答