@import in @media not working in Firefox 3.0.3
Asked Answered
V

2

5

This is what I have, which works in IE7, but not in Firefox:

@media screen { @import 'screen.css'; }

It works outside of the @media block in Firefox:

@import 'screen.css';

UPDATE:

This works:

@media screen { 

    .yui-d3f
    {
        border: 1px solid #999;
        height: 250px;
    }

}

What am I missing?

Vagrancy answered 21/10, 2008 at 22:47 Comment(0)
U
7

Firefox is following the CSS2 specification, while IE is playing fast and loose, as it were.

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.

Here is the pertinent section of the CSS2 specification: 6.3 The @import rule.

Ulema answered 22/10, 2008 at 2:30 Comment(0)
V
1

Ok, so Firefox doesn't like the method I chose, favouring:

@import 'stylesheet.css' media_type;

But IE7 doesn't understand this method, but this could be good:

@import 'firefox-screen.css' screen;
@media screen { @import 'IE7-screen.css'; }
Vagrancy answered 21/10, 2008 at 23:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.