How to remove the underline for anchors(links)?
Use CSS. this removes underlines from a
and u
elements:
a, u {
text-decoration: none;
}
Sometimes you need to override other styles for elements, in which case you can use the !important
modifier on your rule:
a {
text-decoration: none !important;
}
The css is
text-decoration: none;
and
text-decoration: underline;
This will remove your colour as well as the underline that anchor tag exists with
a {
text-decoration: none;
}
a:hover {
color: white;
text-decoration: none;
cursor: pointer;
}
The simplest option is this:
<a style="text-decoration: none">No underline</a>
Of course, mixing CSS with HTML (i.e. inline CSS) is not a good idea, especially when you are using a
tags all over the place.
That's why it's a good idea to add this to a stylesheet instead:
a {
text-decoration: none;
}
Or even this code in a JS file:
var els = document.getElementsByTagName('a');
for (var el = 0; el < els.length; el++) {
els[el].style["text-decoration"] = "none";
}