这些 Mozilla 特定的 CSS 样式有什么作用吗?
我正在使用一些 CSS(来自 Joomla 模板),如下所示:
div#logo {
-moz-background-clip: border;
-moz-background-inline-policy: continuous;
-moz-background-origin: padding;
background: transparent url(../images/head.png) no-repeat scroll 0 0;
...
}
我查找了其中一些 -moz-
属性,它们似乎被分配了默认值,如果我将它们在 Firebug 中关闭,没有任何明显的变化。
是否有理由将它们添加到 CSS 文件中?它们是否适用于旧版本的 Firefox?
I'm working with some CSS (from a Joomla template) like this:
div#logo {
-moz-background-clip: border;
-moz-background-inline-policy: continuous;
-moz-background-origin: padding;
background: transparent url(../images/head.png) no-repeat scroll 0 0;
...
}
I've looked up some of those -moz-
properties and they seem to be assigned their default values, and if I turn them off in Firebug nothing happens visibly.
Would there be a reason to add them to a CSS file? Are they for an old version of Firefox perhaps?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为发生的事情是有人设置了一个
background
快捷方式规则,然后在 DOM 检查器中查看该快捷方式规则产生的“计算样式”。他们注意到,设置样式也会设置 Mozilla 的background-clip
、-origin
和-inline-policy
属性,并尝试重现这些规则而不了解它们的用途(即 Mozilla CSS 实现的细节,以及未来可能的 CSS3)。当然,更改
-moz-background-inline-policy
只会对display: inline
的元素产生任何影响(其中div
不是由默认),并且仅当元素实际上有边框时,更改边框周围的clip
/origin
属性才会产生任何影响。摆脱他们。
I think what's happened is someone's set a
background
shortcut rule and then looked at the ‘computed style’ resulting from that shortcut rule in the DOM inspector. They've noticed that setting the style also sets Mozilla'sbackground-clip
,-origin
and-inline-policy
properties, and tried to reproduce these rules without understanding what they're for (namely a detail of Mozilla's CSS implementation, and potentially CSS3 in future).Certainly changing
-moz-background-inline-policy
would only have any effect on elements that weredisplay: inline
(whichdiv
isn't by default), and changing theclip
/origin
properties around the border would only make any difference if the element actually had a border.Get rid of them.
这些属性很可能不需要存在。我怀疑它们被包含在内是为了确保不同版本的 Firefox 之间的渲染一致。我想答案是,如果您认为在您有兴趣支持的 Firefox 版本中禁用它们没有什么区别,请将它们删除。
Chances are good that these properties don't need to be there. I'd suspect that they're included to ensure consistent rendering across different versions of Firefox. I guess the answer is, if you're seeing no difference from disabling them in the versions of Firefox you're interested in supporting, take them out.
AFAIK 当前的 Firefox 版本不支持
background-clip
,因此作者可能已经将它们放在了先发制人的问题中(尽管这很奇怪,因为无论如何它们都设置为默认值,而且它们还没有不包括 opera 或 webkit 前缀...)background-inline-policy
在所有 Firefox 中默认为Continue
,而background-origin
它们也默认为padding
。我想说这个代码毫无意义。
background-clip
isn't supported on current Firefox builds AFAIK, so the author has probably put them in preempting a problem (though that would be odd as they are all set to the default anyway, and they haven't included the opera or webkit prefixes...)background-inline-policy
is default ascontinuous
in all Firefoxes, andbackground-origin
is default aspadding
in them all too.I'd say pointless code for this one.
我不确定这些特定的属性,但是您是否检查过浏览器没有使用缓存的样式表?
I'm not sure on those particular attributes, but have you checked that the browser isn't using a cached style sheet?