W3C home > Mailing lists > Public > www-style@w3.org > January 2012

Re: @import -- allow at any place in stylesheet.

From: Marat Tanalin | tanalin.com <mtanalin@yandex.ru>
Date: Wed, 18 Jan 2012 01:57:24 +0400
To: Tab Atkins Jr. <jackalmage@gmail.com>
Cc: www-style@w3.org
Message-Id: <40681326837444@web153.yandex.ru>
18.01.2012, 01:35, "Tab Atkins Jr." <jackalmage@gmail.com>:
> 2012/1/17 Marat Tanalin | tanalin.com <mtanalin@yandex.ru>:
>
>> 18.01.2012, 01:01, "Tab Atkins Jr." <jackalmage@gmail.com>:
>>> 2012/1/17 Marat Tanalin | tanalin.com <mtanalin@yandex.ru>:
>>>> 17.01.2012, 22:49, "Tab Atkins Jr." <jackalmage@gmail.com>:
>>>>> Alternately, this works today:
>>>>>
>>>>> <style>
>>>>> @import "main.css";
>>>>> @import "override.css";
>>>>> </style>
>>>> We can't, we are _forced_ to.
>>>>
>>>> It would be nice improvement of core CSS syntax if web-developers would get able to link to one CSS file in HTML document, and then to flexibly control cascading on pure CSS level.
>>> What is wrong with the fragment I provided above?
>> It's not wrong, it's different from what I'm talking about. I'm not going to repeat myself though.
>
> You are *specifically* asking for the ability to use a <link> element.
> That's remarkably specific. I offered an example that accomplishes
> the same thing using the <style> element. What is wrong with that
> example? Why are you requiring that a solution specifically use the
> <link> element?
>
> (Note that my example is equivalent to just putting in two <link>
> elements, anyway.)

I'm not talking about specific _method_ to link to CSS file from HTML document. I'm talking about linking to _one_ CSS file (be it via <link> or @import-inside-<style> -- it does not matter), and then controlling cascading purely on _CSS level_.

Both methods to include CSS files into HTML document are equivalent:

    <!-- We could use link element... -->
    <link rel="stylesheet" href="main.css" />

    <style>
        /* ...or single import inside style element.
           It does not matter what of them. */
        @import "main.css";
    </style>

> Stepping outside this problem, you shouldn't really be using @import
> in your stylesheets anyway. It's bad for performance, since it makes
> your stylesheets download one-by-one instead of in parallel. Making
> @import more powerful might encourage more use of this, which I'd
> personally prefer to avoid. It's better to either link in multiple
> stylesheets via multiple <link> elements (so the browser can start
> downloading all of them at once), or use a preprocessor to munge the
> sheets together into a single file so you can pull them all down with
> a single request.

As I've already said, there are different situations: internet, intRAnet, local webpages opened from CD. Delay concern is generally applicable to former one only, but current limitation is applied forcedly and harmfully to all of them.
Received on Tuesday, 17 January 2012 21:58:01 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:48 GMT