Someone asked in a thread about Drupal's support of IE 5.5. why Drupal is importing rather than linking stylesheets in index.php : http://drupal.org/node/112842.
Now correct me if I am wrong... (I probably am...)
The only advantage of importing stylesheets in an html page (using <style type="text/css">@import url(external.css);</style>) is to hide the stylesheet from Netscape 4.x.
A disadvantage of the @import method (compared to using the link element : <link rel="stylesheet" type="text/css" href="external.css" />) is that, in IE7 (I haven't tested in IE6), imported stylesheets are not cached by the browser. That means that everytime we load an html document that uses the import method, the stylesheet is loaded, increasing load time. I know this because when I refresh the browser after a minor edit in style.css I don't need to clear the browser's cache to see the changes in IE, as I need to in Firefox.
I would really like an explanation for both Drupal 4.7.x and 5.x, as there seems to be different ways to handle css files in these two versions of Drupal.
THANKS in advance.
Comments
This is a very good question.
Apparently the only issue standing between Drupal 5 and IE5.5 compatibility is the use of
... @import ...method to ref the stylesheet rather than<link ...>. The thread that Caroline mentions above also offers some pretty compelling reasons for making at least a little effort towards IE5.5 compatibility.I realise that browser-compatibility is an unpopular subject for everyone, including those people who have to deal with it, but in this case the argument - so far - is fairly one-sided in favour of changing the way drupal calls stylesheets.
Can anyone put forward any reasons why the
... @import ...method is better than<link ...>?... Would changing it impact on Drupal Core CSS Preprocessor (admin/settings/performance - bandwidth settings - 'aggregate and compress CSS files'), for example ?
(subscribing)
(subscribing)
I use both—including one
I use both—including one stylesheet with link and another stylesheet (like the print one) with import—in order to avoid that brief flash of unstyled content that can happen in IE, as detailed here: http://www.brightlemon.com/web-design/blog/?p=27