Re: @important instead of multiple !important

2012/1/5 Marat Tanalin | tanalin.com <mtanalin@yandex.ru>:
> 06.01.2012, 03:30, "Tab Atkins Jr." <jackalmage@gmail.com>:
>> !important is *almost always* a bad idea in author stylesheets, and I
>> don't want to support anything making it more convenient.
>
> !important _is_ used in real world anyway.

Yes, so I wouldn't advocate removing it entirely (even if I think it
would probably be a good idea).  I'm just saying that I don't want to
make it *easier* to use !important in author stylesheets.


>> You're right, though, that it's often necessary to put !important on
>> every single declaration in user stylesheets.  Perhaps we can solve
>> this in an easier way.  For example, asking browser vendors to support
>> two user stylesheets, one of which is processed normally and the other
>> which is automatically placed in the user!important level (wherein
>> !important wouldn't do anything).
>>
>> This way you can easily distinguish en-masse between setting your own
>> defaults (the use of the normal user level) and overriding the page's
>> styles (the use of the user!important level).
>
> Do you mean that we will then be forced to have two separate CSS files?
>
> If so, it would be not as usable as @important rule would be since latter would allow to put all user styles in one stylesheet.

Sure, it would be less convenient in some ways.  It's also better in
some ways - it cleanly distinguishes between the two uses that user
stylesheets are put to.

Importantly, though, it requires zero additions to the CSS language.
Given that user stylesheets are important but niche, finding solutions
that don't involve expanding the language is somewhat valuable.

~TJ

Received on Thursday, 5 January 2012 23:49:25 UTC