Html 使用 href 属性删除下划线

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

Removing underline with href attribute

htmlhrefunderline

提问by Victor Mukherjee

Possible Duplicate:
How to remove the underline for anchors(links)?

可能的重复:
如何删除锚点(链接)的下划线?

In the following code below, the link gets underlined when I use the href attribute.

在下面的代码中,当我使用 href 属性时,链接会带有下划线。

<html>
<body>
<a href="xxx.html">goto this link</a>
</body>
</html>

I want the link to be associated with that tag, but not to be underlined. How can I do that? Thanks in advance for your help.

我希望链接与该标签相关联,但不加下划线。我怎样才能做到这一点?在此先感谢您的帮助。

回答by Curt

Add a style with the attribute text-decoration:none;:

添加带有属性的样式text-decoration:none;

There are a number of different ways of doing this.

有许多不同的方法可以做到这一点。

Inline style:

内联样式:

<a href="xxx.html" style="text-decoration:none;">goto this link</a>

Inline stylesheet:

内联样式表:

<html>
<head>
<style type="text/css">
   a {
      text-decoration:none;
   }
</style>
</head>
<body>
<a href="xxx.html">goto this link</a>
</body>
</html>

External stylesheet:

外部样式表

<html>
<head>
<link rel="Stylesheet" href="stylesheet.css" />
</head>
<body>
<a href="xxx.html">goto this link</a>
</body>
</html>

stylesheet.css:

样式表.css:

a {
      text-decoration:none;
   }