@import在@media不工作在Firefox 3.0.3 [英] @import in @media not working in Firefox 3.0.3
问题描述
这是我有,它在IE7,但不是在Firefox中工作:
This is what I have, which works in IE7, but not in Firefox:
@media screen { @import 'screen.css'; }
它在Firefox的@media块外部工作:
It works outside of the @media block in Firefox:
@import 'screen.css';
更新:
这个工作原理:
@media screen {
.yui-d3f
{
border: 1px solid #999;
height: 250px;
}
}
p>
推荐答案
Firefox正在遵循CSS2规范,而IE正在快速松动。
Firefox is following the CSS2 specification, while IE is playing fast and loose, as it were.
确切的原因是 @import
指令必须是可选 @charset
指令。它们不能出现在任何块中。如果您希望 @import
只应用于一种媒体类型,请在导入的URI后指定
The exact reason is that @import
directives must be the first directives after the optional @charset
directive. They cannot appear inside of any block. If you want an @import
to apply to only one media type, specify that after the imported URI.
是CSS2规范的相关部分: 6.3 @import
规则。
Here is the pertinent section of the CSS2 specification: 6.3 The @import
rule.
这篇关于@import在@media不工作在Firefox 3.0.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!