Css firefox如何决定使用哪种@-moz文档规则?

Css firefox如何决定使用哪种@-moz文档规则?,css,firefox,Css,Firefox,我已经为运行在Fedora19上的Firefox26创建了一个自定义userContent.css文件 我试图找出moz文档规则的优先顺序 我想做的是为社区页面设置一组规则,为站点上的所有其他页面设置另一组if规则 我试过 @-moz-document url-prefix(https://discussions.apple.com/community/) {/* rules for this page */} @-moz-document domain(disc

我已经为运行在Fedora19上的Firefox26创建了一个自定义userContent.css文件

我试图找出moz文档规则的优先顺序

我想做的是为社区页面设置一组规则,为站点上的所有其他页面设置另一组if规则

我试过

@-moz-document   
    url-prefix(https://discussions.apple.com/community/) 
{/* rules for this page */}


@-moz-document  
    domain(discussions.apple.com) 
{ /* different rules  for all other pages in domain. */}

我发现我的url前缀规则被忽略了。

如果两个规则中的属性相同,那么后者将覆盖前者,因为当所有东西都被认为相等时,CSS会自上而下地应用规则,因此,由于也匹配discussions.apple.com,后者的规则也会应用,如果您愿意,您可以交换订单,这应该会有所帮助

/*

  Where to place a new css tag?

  Find the conditional code, "the if statements".
  The conditional code starts with @.     

  In some ways, you can think that all the css rules 
  are applied that in parallel. 

  In the case you add a new rule with with an attribute that you haven't used
  before, the rule can be place anywhere in the conditional block that applies.  
  In case of conflicting attributes, the last 
  seen attribute is used.  

*/

/* if the domain of the web page is any of these,
    apply the css below, between the matching {}. */
@-moz-document  
  domain(discussions.apple.com),
  domain(communities.apple.com),
  domain(discussionsjapan.apple.com),  
  domain(discussionskorea.apple.com)  
{  

   ... lots of css ...

   /* for pages from all devices and the width of the page
       is larger than 1265px, apply the css. 
       Remember, we are inside of the @-moz-document conditional. 
       So the @media rule, only see pages that of passed @-moz-document 
       conditional. */
   @media all and (min-width: 1265px) 
   {   
     /* styles for a large browser window  */

     ... lots of css ...

   }

   /* for pages from all devices and the width of the page
      is less than or equal to 1265px, apply the css. */
   @media all and (max-width: 1265px) 
   {                                             
      /* styles for narrow browsers window  */

       ... lots of css ...

    }  

} /* end of @-moz-document */ 


/* another conditional.  The style rules will be applied
   to any page with an URL starting with. Note, this 
   @-moz-document rules is applied separately from the 
   prior @-moz-document conditional. */
@-moz-document  
  url-prefix(https://discussions.apple.com/people/),
  url-prefix(https://discussions.apple.com/welcome),
  url-prefix(https://discussionsjapan.apple.com/people/),  
  url-prefix(https://discussionsjapan.apple.com/welcome/),
  url-prefix(https://discussionskorea.apple.com/people/),
  url-prefix(https://discussionskorea.apple.com/welcome/)    
    {
      /* These rules get applied on the pages that match. 
         Remember, the last setting of the attribute wins. */
      ... lots of css ...
    }  /* end of @-moz-document */ 


对于不同的页面,我确实有多个@-moz文档url前缀。有点乱了。我希望把事情简化。您认为userContent.css文件中的重复规则是个好主意吗?从长远来看,它可能会造成更多的混乱吗?如果它不符合您的特定规则,那么作为一个总括的做法是完全可以的,只要确保考虑到顺序,让您的基础样式保持在顶部,然后针对下面的小教派,因为下面的任何内容都会覆盖上面的内容。