简体   繁体   English

如何从文本超链接中删除下划线?

[英]How to remove underline from text hyperlink?

I got a problem in my css file, I used this following code: 我的css文件中出现问题,我使用了以下代码:

text-decoration: none;

But still it doesnt have effect on text, for some reason I had to use java script for href link behind text. 但是它仍然对文本没有影响,由于某种原因,我不得不对文本后面的href链接使用Java脚本。 But I think so because of this issue text decoration doesn't has effect on the text. 但是我想是因为这个问题,文本修饰对文本没有影响。 even I can't use different color on text like hover and mouse over color. 即使我不能在文本上使用其他颜色,例如悬停和鼠标悬停在颜色上。

Here is code: 这是代码:

 $(function() 
{
$('.maincaptionsmall').wrapInner('<a href="http://google.com"></a>');
});

and here is html code: 这是html代码:

<span class="maincaptionsmall">Home</span>

For your information I used text decoration none even inline of href code, but it doesn't has effect. 为了给您提供信息,我使用了文本修饰,甚至没有内联href代码,但这没有效果。

I'm gonna remove underline from Home text and use different color for mouse over something like this: 我要从“首页”文本中删除下划线,然后将不同颜色的鼠标悬停在这样的位置上:

:hover { color: yellow; }

Thanks in advance. 提前致谢。

CSS for <A> tag <A>标签的CSS

a {text-decoration: none;}
a:hover {color: yellow;}

CSS for <SPAN> tag <SPAN>标签的CSS

.maincaptionsmall a {text-decoration: none;}
.maincaptionsmall a:hover {color: yellow;}

I see it works well on IE9+ and Chrome 14+. 我认为它在IE9 +和Chrome 14+上运行良好。 Hopes that help :) 希望对您有所帮助:)

Use this 用这个

.maincaptionsmall a {text-decoration:none;}
.maincaptionsmall a:hover {color: yellow;}

Try the rule 尝试规则

.maincaptionsmall a {
    text-decoration: none;
}

If its coz due to JS function, then you can try using inline css within ur JS 如果由于JS功能导致问题,那么您可以尝试在JS中使用内联CSS

$(function() 
{
$('.maincaptionsmall').wrapInner('<a style="text-decoration:none;" href="http://google.com"></a>');
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM