如何制作不突出显示的 HTML 链接?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3114052/
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-29 03:36:27  来源:igfitidea点击:

How do I make an HTML link that doesn't highlight?

htmlcss

提问by Anonymous the Great

What I mean by that, is having a link without it highlighting purple/blue when you click it/don't click it.

我的意思是,当你点击/不点击它时,有一个链接没有突出显示紫色/蓝色。

回答by Adam

You need to add some CSS styling using CSS pseudo-classes.

您需要使用 CSS 伪类添加一些 CSS 样式。

Here is an example showing CSS added to the head element in a style tag that changes all links to always be black. However, ideally CSS should be in an external file and for usability you probably want to give some indication that the text is a link.

这是一个示例,显示了添加到样式标记中的 head 元素的 CSS,该样式将所有链接更改为始终为黑色。然而,理想情况下 CSS 应该在一个外部文件中,并且为了可用性,您可能希望给出一些文本是链接的指示。

<head>
    <style type="text/css">
       a:link {color: black;}      /* unvisited link */
       a:visited {color: black;}   /* visited link */
       a:hover {color: black;}     /* mouse over link */
       a:active {color: black;}    /* selected link */
    </style>
</head>

See:

看:

回答by Hyman Marchetti

You can use the following css, either in a stylesheet or enclosed in <style>tags:

您可以在样式表中或包含在<style>标签中使用以下 css :

a {
   text-decoration: none;
} 

回答by Ben Everard

Try this :-)

尝试这个 :-)

a:visited {
    color: black;
}

回答by alejandrobog

If you want it for all your website you can set the style of your body, something like this:

如果你想在你的所有网站上使用它,你可以设置你的身体风格,如下所示:

body a
{
  color: #000000;
}

回答by orandov

You have to use the CSS Pseudo Classesto style it.

你必须使用CSS 伪类来设置它的样式。

a, a:visited{
     color:#000;
}