开发者

How to force firefox to use custom CSS for anchor tags that contain "#" or "javascript:"?

To set your own colors for anchor, I know we can do this in UserContent.css: a { color:green!important; background-color: white!important; font-size: 1.2em!important; }

But how to set a specific color for the anchor tag that references th开发者_开发百科e same page (the "#" is in the url). Or if "javascript:" is in the ural of the anchor tag?


Use the attribute-starts-with selector:

a[href^="javascript:"], a[href^="#"] {
    color: red;
}


Looks like the CSS3 Attribute Selector will work in Firefox 3.0+.

a[href^="#"]
{
  ⋮ declarations
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜