Html 蓝色和紫色默认链接,如何删除?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10312857/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 23:58:30  来源:igfitidea点击:

Blue and Purple Default links, how to remove?

htmlcss

提问by panthro

This is one of the links in my nav:

这是我的导航中的链接之一:

<li><a href="#live-now" class="navBtn"><span id="navLiveNow" class="white innerShadow textShadow">Live Now</span></a></li>

I also have the following in my css:

我的 css 中还有以下内容:

a { text-decoration: none; }
a:visited { text-decoration: none; }
a:hover { text-decoration: none; }
a:focus { text-decoration: none; }
a:hover, a:active { text-decoration: none; }

But the links still display in the awful blue/purple visited /hover html default. What am i doing wrong?

但是链接仍然以糟糕的蓝色/紫色访问/hover html 默认显示。我究竟做错了什么?

回答by Andreas Wong

You need to override the color:

您需要覆盖颜色:

a { color:red } /* Globally */

/* Each state */

a:visited { text-decoration: none; color:red; }
a:hover { text-decoration: none; color:blue; }
a:focus { text-decoration: none; color:yellow; }
a:hover, a:active { text-decoration: none; color:black }

回答by daniel

REMOVE DEFAULT LINK SOLVEDthat :visited thing is css.... you just go to your HTML and add a simple

REMOVE DEFAULT LINK SOLVEDthat :visited thing is css .... 你只需转到 HTML 并添加一个简单的

< a href="" style="text-decoration: none"> < /a>

<A HREF = “”风格= “文字修饰:无”> </ A>

... thats the way html pages used to be

...这就是过去 html 页面的方式

回答by Fahad Zakir

<a href="https://www." style="color: inherit;"target="_blank">

For CSS inline style, this worked best for me.

对于 CSS 内联样式,这对我来说效果最好。

回答by Rokan Nashp

By default link color is blueand the visitedcolor is purple. Also, the text-decoration is underlinedand the color is blue. If you want to keep the same color for visited, hover and focus then follow below code-

默认链接颜色为蓝色访问颜色为紫色。此外,文本装饰带有下划线,颜色为blue。如果您想为访问过的,悬停和聚焦保持相同的颜色,然后按照以下代码-

For example color is: #000

例如颜色是:#000

a:visited, a:hover, a:focus {
    text-decoration: none;
    color: #000;
}

If you want to use a different color for hover, visited and focus. For example Hovercolor: red visitedcolor: green and focuscolor: yellow then follow below code

如果您想为悬停、访问和焦点使用不同的颜色。例如悬停颜色:红色访问颜色:绿色和焦点颜色:黄色然后按照下面的代码

   a:hover {
        color: red;
    }
    a:visited {
        color: green;
    }
    a:focus {
        color: yellow;
    }

NB: good practice is to use color code.

注意:好的做法是使用颜色代码。

回答by Rohit Azad

Hey define color #000into as like you and modify your css as like this

嘿,将颜色定义#000为像您一样,并像这样修改您的 css

.navBtn { text-decoration: none; color:#000; }
.navBtn:visited { text-decoration: none; color:#000; }
.navBtn:hover { text-decoration: none; color:#000; }
.navBtn:focus { text-decoration: none; color:#000; }
.navBtn:hover, .navBtn:active { text-decoration: none; color:#000; }

or this

或这个

 li a { text-decoration: none; color:#000; }
 li a:visited { text-decoration: none; color:#000; }
 li a:hover { text-decoration: none; color:#000; }
 li a:focus { text-decoration: none; color:#000; }
 li a:hover, .navBtn:active { text-decoration: none; color:#000; }

回答by Shailender Arora

If you wants display anchors in your own choice of colors than you should define the color in anchor tag property in CSSlike this:-

如果您想以您自己选择的颜色显示锚点,那么您应该在CSS中的锚点标记属性中定义颜色,如下所示:-

a { text-decoration: none; color:red; }
a:visited { text-decoration: none; }
a:hover { text-decoration: none; }
a:focus { text-decoration: none; }
a:hover, a:active { text-decoration: none; }

see the demo:- http://jsfiddle.net/zSWbD/7/

看演示:- http://jsfiddle.net/zSWbD/7/