Removing underline with href attribute

Victor Mukherjee picture Victor Mukherjee · Sep 21, 2012 · Viewed 189.9k times · Source

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.

<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.

Answer

Curt picture Curt · Sep 21, 2012

Add a style with the attribute 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:

a {
      text-decoration:none;
   }