View Full Version : @import... any disadvantages?

02-16-2005, 07:55 PM
I asked this question semi-off-topic in another thread and it sort of got lost in the shuffle. I did some research and couldn't find anything. The question: Are there any disadvantages to using @import methods of linking to CSS? Besides the obvious (legacy browsers don't understand it)...

02-16-2005, 08:18 PM
I think Opera 7.5, in small screen rendering mode, ignores any stylesheets imported in this way. I'm not too well up on this, but I think the main problem may be that some non-conventional, but modern, user agents dont get @import.

Kind Regards,


02-16-2005, 09:00 PM
Hmm, haven't tried Opera in small screen rending mode, but I doubt that it's a problem. More likely the problem is media type related..

One problem with @import is that iew only allows three levels of importation. Not that I think there's especially many that use more than one level in any case...

02-16-2005, 09:10 PM
I think one advantage to referencing the .css thru the <link> element is that you can take advantage of the rel and title attributes.


Specify that the style sheet is persistent, preferred, or alternate:
To make a style sheet persistent, set the rel attribute to "stylesheet" and don't set the title attribute.
To make a style sheet preferred, set the rel attribute to "stylesheet" and name the style sheet with the title attribute.
To specify an alternate style sheet, set the rel attribute to "alternate stylesheet" and name the style sheet with the title attribute.


When the LINK element links an external style sheet to a document, the type attribute specifies the style sheet language and the media attribute specifies the intended rendering medium or media. User agents may save time by retrieving from the network only those style sheets that apply to the current device.

02-16-2005, 11:47 PM
If you wanted opera to use your stylesheet in SSR mode, you would declare it like so:

<style type="text/css" media="screen,handheld">

The main problem with @import is that it suffers from flash of unstyled content (http://www.bluerobot.com/web/css/fouc.asp).

02-17-2005, 06:33 PM
Thanks for the tips guys... good point about the "rel" and "title" attributes.