且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

@ -moz-document无法正常工作

更新时间:2023-09-17 11:24:22

从表面上看,这似乎是因为您的@-moz-document出现在float:none规则之前,因此无论如何它都会被覆盖.有条件规则的存在不会改变级联的工作方式.这是常见

On the surface it would seem to be because your @-moz-document appears before the float:none rule — so it will always get overridden regardless. The presence of a conditional at-rule does not change how the cascade works; this is a common gotcha with @media rules and applies just as well to @-moz-document.

您要将其移至底部,以便在Firefox中正确覆盖以前的规则:

You want to move it to the bottom so it will override the previous rule properly in Firefox:

<style>
  .attempt {
    float:none
  }
  @-moz-document url-prefix() {
    .attempt {
      float:left
    }
  }
</style>

<div class="attempt">someText</div>