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

Re: @important instead of multiple !important

From: Marat Tanalin | tanalin.com <mtanalin@yandex.ru>
Date: Fri, 06 Jan 2012 04:18:08 +0400
To: Jeffrey Way <jeffrey@envato.com>
Cc: Tab Atkins Jr. <jackalmage@gmail.com>,www-style@w3.org
Message-Id: <209831325809088@web154.yandex.ru>
Considering your point, shortening '!important' to '!' (while being not so DRY as @important would be) would have similar result: "encourage newcomers to use and abuse it".

06.01.2012, 04:10, "Jeffrey Way" <jeffrey@envato.com>:
> The problem is that, if introduced, it *really* encourages newcomers to use and abuse it. The potential uses are so rare that it doesn't seem necessary. More bad good potentially come from it than good.
> I'm in favor of: prop: val !;
> Jeffrey
> On Thursday, January 5, 2012 at 7:03 PM, Marat Tanalin | tanalin.com wrote:
>> 06.01.2012, 03:48, "Tab Atkins Jr." <jackalmage@gmail.com>:
>>> 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.
>> Sounds somewhat odd for me. There are cases where it's needed to override previous rules exactly once, thus not resulting in any bad consequences as for specificity. Grouping such rules inside @important rule would improve readability of CSS code in such cases.
>>>>> š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
>> A probable usable option is to add @important to CSS spec but limit its application to user stylesheets only.
Received on Friday, 6 January 2012 00:27:06 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:54 UTC