Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

url filter doesn't work in userContent.css

  • 23 个回答
  • 8 人有此问题
  • 1 次查看
  • 最后回复者为 nimnull22

more options

Linux x86_64, Firefox 28

In my userContent.css I have:

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain(www.utro.ru)
{
  * {
    font-family: "Arial" !important;
    font-size:   10px !important;
    }
}


  * {
    font-family: "Verdana" !important;
    font-size:   15px    !important;
    line-height: 1.3em   !important;
  }
  h1, h2, h3, h4, h5, h6 {
    font-family: Verdana !important;
    font-size: 13px !important;
    font-weight: bold !important;
  }

What I expected is to see "www.utro.ru" with Arial font and 10 px size Other pages - with Verdana font and 15px size. But in reality Firefox draws every page with Verdana 15px.


If I remove every other conditions:

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain(www.utro.ru)
{
  * {
    font-family: "Arial" !important;
    font-size:   10px !important;
    }
}

Firefox starts to draw is expected - Arial 10px. Other pages with default font from configuration.

Is it another bug or I did something wrong? Firefox ignores more then one url filter condition!

Linux x86_64, Firefox 28 In my userContent.css I have: <pre><nowiki>@namespace url(http://www.w3.org/1999/xhtml); @-moz-document domain(www.utro.ru) { * { font-family: "Arial" !important; font-size: 10px !important; } } * { font-family: "Verdana" !important; font-size: 15px !important; line-height: 1.3em !important; } h1, h2, h3, h4, h5, h6 { font-family: Verdana !important; font-size: 13px !important; font-weight: bold !important; }</nowiki></pre> What I expected is to see "www.utro.ru" with Arial font and 10 px size Other pages - with Verdana font and 15px size. But in reality Firefox draws every page with Verdana 15px. If I remove every other conditions: <pre><nowiki>@namespace url(http://www.w3.org/1999/xhtml); @-moz-document domain(www.utro.ru) { * { font-family: "Arial" !important; font-size: 10px !important; } }</nowiki></pre> Firefox starts to draw is expected - Arial 10px. Other pages with default font from configuration. Is it another bug or I did something wrong? Firefox ignores more then one url filter condition!

由cor-el于修改

被采纳的解决方案

nimnull22 wrote:

Thank you. Your solution works as expected.

You're welcome.

nimnull22 wrote:

How to exclude one site.

Here's an example of a global style with an exception. Just replace the placeholders with actual domain names. Add another | symbol followed by the domain name to add another exception.


@-moz-document regexp("https?://(?!(utro.ru|example-of-an-exception.com|www.placeholder.site-exception.net)).*") {

/* The following is for all sites except Utro.ru */
* { font-family: "Comic Sans MS" !important; }

}

/* The following is just for support.mozilla.org
It will override the global declaration above */
@-moz-document domain("support.mozilla.org") {

* { font-family: "Times New Roman" !important; }

}

定位到答案原位置 👍 0

所有回复 (3)

more options

OK.

Everything works except for one problem.

I need one domain uses its own font and font-size.

How to exclude one site. For example I need it to uses Verdana for sans-serif and Courier New for monospace?

more options

选择的解决方案

nimnull22 wrote:

Thank you. Your solution works as expected.

You're welcome.

nimnull22 wrote:

How to exclude one site.

Here's an example of a global style with an exception. Just replace the placeholders with actual domain names. Add another | symbol followed by the domain name to add another exception.


@-moz-document regexp("https?://(?!(utro.ru|example-of-an-exception.com|www.placeholder.site-exception.net)).*") {

/* The following is for all sites except Utro.ru */
* { font-family: "Comic Sans MS" !important; }

}

/* The following is just for support.mozilla.org
It will override the global declaration above */
@-moz-document domain("support.mozilla.org") {

* { font-family: "Times New Roman" !important; }

}

more options

@ Gingerbread Man

Thanks a lot for your examples. Now all works as I expected.

  1. 1
  2. 2