2

I've been trying to remove an ugly underline from a webpage but for some reason it just won't go away.

I've tried using text-decoration:none; and color: #FFFFFF; to no avail.

Original css:

#noday {
    color: #ECECEC;
    font-family: "Times New Roman",Times,serif;
    font-size: 1em;
}

The snippet of code:

<a href="http://www.example.com/content/" target"_blank"><div id="noday"><br><br>Random text here</div></a>

Real example: http://jsfiddle.net/c0c6g4rd/

I've looked at: Remove stubborn underline from link but it hasn't helped :/

Community
  • 1
  • 1
Ryflex
  • 5,559
  • 25
  • 79
  • 148

5 Answers5

16

Just add text-decoration:none; to a tag for #noneall:

#noneall a{
    text-decoration:none;
}

Here is a jsfiddle.

Henrik Petterson
  • 6,862
  • 20
  • 71
  • 155
2

Try this, add a id(or class) to your a href

<a href="http://www.example.com/content/" id="thisLink" target"_blank">Random text here</a>

and add this to your css file:

#thisLink{
    text-decoration: none;
}

This should remove the underline!

Here a Jsfiddle of that:

http://jsfiddle.net/c0c6g4rd/4/

CJR
  • 3,174
  • 6
  • 34
  • 78
2

Add at the beginning of your css file:

a{
 text-decoration:none;
}

With these lines you will remove this underline from all links in your html.

Héctor
  • 509
  • 2
  • 7
0

Just to make sure, try adding a !important after your text-decoration: none:

a{text-decoration: none !important}

If that does work, then there is a hierarchy problem and something else is overriding your declaration. Also try putting your declaration at the END of your CSS to override any other declarations.

Matthieu
  • 2,736
  • 4
  • 57
  • 87
Matt
  • 26
  • 2
0

The root of this problem is that you can't put a div (a block-level element) inside an a (an inline element. However, there are better ways of doing what you're trying to do.

As the others said, this will apply to all links:

a { text-decoration: none; }

However, if you only want to apply it to that one link, add the id to the a like this rather than using another element:

<a ... id="noday">...</a>

Then style the same way.

Fiddles of examples:

http://jsfiddle.net/9gsu9ok3/ (Style all links)

http://jsfiddle.net/9gsu9ok3/3/ (Style only certain links)

Hope this helps.

eritbh
  • 726
  • 1
  • 9
  • 18