I have a simple question about creating hyperlinks.. clickme 开发者_JAVA百科 creates a hyperlink but click me would be underlined... How do I create a hyperlink where links would not be underlined..Should I be using css??
Thanks
use css. something like this:
a
{
text-decoration: none;
}
to restore underline on hover:
a:hover
{
text-decoration:underline;
}
you may replace a with a class selector or an Id.
EDIT: typos;
Yes, you should use css.
<a href="link" style="text-decoration: none;">asdf</a>
Use css for hiding underline from anchor tag:
'a:link { text-decoration: none}'
http://jsfiddle.net/sushant_ceb/L9KNT/
To disable underline for all hyperlinks in the document, use
<STYLE TYPE="text/css">
<!--
A:link {text-decoration: none}
-->
</STYLE>
in the head of your HTML-File.
To only disable underlining for certain hyperlinks, use
<STYLE TYPE="text/css">
<!--
A:link.nounderline {text-decoration: none}
-->
</STYLE>
and define hyperlinks not to be underlined as usual (<a href="://www.google.com">Google</a>
), but use your nounderline
class for those that shall not be underlined:
<a class="nounderline" href="http://www.yahoo.com">Yahoo</a>
To read more about what you can do with text decoration (besides merely underlining or not), read the CSS3 Text Specs.
精彩评论