开发者

CSS a:link,a:active,a:visited dont apply on my tags

I got the following CSS rule in my page:

a:link,a:active,a:visited{text-decoration:none;}

for some reason It doesnt work.. If I want to apply this rule, lets say inside div with id="test" I need to us开发者_运维知识库e this rule:

#test a:link,#test a:active,#test a:visited{text-decoration:none;}

and I have no idea why.. Do you have any clue why this is happening?


Try this

   a:link,a:active,a:visited{text-decoration:none !important;}


There's most likely another rule that is overriding the style for your links. Ideally, use the browser's developer tools to inspect the CSS, that will show you which styles are overriding yours and enable you to debug what's going on.

Alternatively, if you definitely want text-decoration: none for all links, you can use the !important flag to force the styles to apply:

a:link, a:active, a:visited { text-decoration:none!important; }


Because your link rules are defined somewhere else and you need to specify them to make them stronger and overwrite your other definition.

You have to provide more code (both html & css) to locate the problem.


When I try this in jsfiddle it all works correctly. http://jsfiddle.net/g6Eqx/1/. Do you have another css rule which is stronger than this rule in your css?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜