Is there anyway (in CSS) to avoid the underline for the text and links introduced in the page .. ?
Is there anyway (in CSS) to avoid the underline for the text and links introduced in the page .. ?
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;
}
I've been troubled with this problem in web printing and solved. Verified result.
a {
text-decoration: none !important;
}
It works!
To provide another perspective to the problem (as inferred from the title/contents of the original post):
If you want to track down what is creating rogue underlines in your HTML, use a debugging tool. There are plenty to choose from:
For Firefox there is FireBug;
For Opera there is Dragonfly (called "Developer tools" in the Tools->Advanced menu; comes with Opera by default);
For IE there is the "Internet Explorer Developer Toolbar", which is a separate download for IE7 and below, and is integrated in IE8 (hit F12).
I've no idea about Safari, Chrome and other minority browsers, but you should probably have at least one of the three above on your machine anyway.
Don't forget to either include stylesheets using the link tag
http://www.w3schools.com/TAGS/tag_link.asp
Or enclose CSS within a style tag on your webpage.
<style>
a { text-decoration:none; }
p { text-decoration:underline; }
</style>
I wouldn't recommend using the underline on anything apart from links, underline is generally accepted as something that is clickable. If it isn't clickable don't underline it.
CSS basics can be picked up at w3schools
<u>
is a deprecated tag.
Use...
<span class="underline">My text</span>
with a CSS file containing...
span.underline
{
text-decoration: underline;
}
or just...
<span style="text-decoration:underline">My Text</span>
The underline may be removed by a CSS property called text decoration.
<style>
a {
text-decoration:none;
}
</style>
If you want to remove the underline for the text present in the elements other than a, the following syntax should be used.
<style>
element-name{
text-decoration:none;
}
</style>
There are many other text-decoration values that may help you to design links.