tags:

views:

469

answers:

6

Edited the tag and body, to make it clear for newbies ..

Is there anyway (in CSS) to avoid the underline for the text and links introduced in the page .. ?

+2  A: 

Use CSS to remove text-decorations.

a {
    text-decoration: none;
}
Alan Haggai Alavi
+5  A: 

The css is

text-decoration: none;

and

text-decoration: underline;
DanDan
+1 dispite a CSS answer to a question "which HTML tags" :)
Dead account
There are 2 questions, in the subject and the body. He's answering the body question :)
MDCore
+8  A: 

Use CSS. This will remove all underlines from your page:

body {
    text-decoration: none !important;
}

You can also do it on selected elements:

a, u {
    text-decoration: none;
}
Emil Vikström
+1  A: 

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.

Vilx-
Safari 3/4: http://www.macobserver.com/tmo/article/Safari_3.1_The_Magical_Develop_Menu/
mplungjan
A: 

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

JasonS
A: 
<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>
Moose Factory