开发者

unable to change link color in IE8

I have apply a classname "bSelect" to a Link element, it could apply background image but not converting the link into white开发者_JAVA技巧?

.bSelect {background:url('../../img_assets/bs1.png') 0 0 no-repeat;background-position:center;color:#fff;}


The most specific rule will always apply, so if you have the following somewhere:

a.bSelect { color: red; }

Then it will always take presidence over a less-specific rule, like:

.bSelect { color: white; }

Adding "!important" to the end of the rule forces it to be applied (though again, if you have multiple "!important"s, the most specific wins again).

It's usually a good idea to try and avoid "!important" and instead figure out why the rule isn't being applied. There ae built-in tools in most browsers to help you trace which CSS styles are being applied. However, "!important" works and is often easier than trying to rewrite CSS rules to make them work.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜