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 02:41:47 +0400
To: Jeffrey Way <jeffrey@envato.com>
Cc: www-style@w3.org
Message-Id: <574601325803307@web49.yandex.ru>
My main usecase is user stylesheets where !important for exacly _each_ property is needed to reliably override original author CSS-rules.

06.01.2012, 02:39, "Jeffrey Way" <jeffrey@envato.com>:
> I'd worry that this will encourage bad habits. I haven't found myself needing to make multiples lines important frequently enough to warrant this type of addition. It makes sense in some cases (especially when dealing with imported third party stylesheets that you may not have control over) , but, other than that, I'm not sure how useful this would be. At the very least, it shouldn't be encouraged unless you can describe exactly why you're using !important.
> Jeffrey
>
> On Thursday, January 5, 2012 at 5:29 PM, Marat Tanalin | tanalin.com wrote:
>> Writing user stylesheets, we're often forced to add "!important" after value of each property (generally, the proposal should not be limited to user stylesheets though).
>> It would be much more usable and DRY to have at-rule of the same name to prevent redundant multiple "!important" word duplication.
>> For example, currently we write:
>> #statusbar-display {
>> left: 0 !important;
>> right: auto !important;
>> }
>> #statusbar-display .statuspanel-label {
>> border-left-style: none !important;
>> border-right-style: solid !important;
>> }
>> Instead we could wrap the rules to one @important rule, thus avoiding repeating "!important" multiple times:
>> @important {
>> #statusbar-display {
>> left: 0;
>> right: auto;
>> }
>> #statusbar-display .statuspanel-label {
>> border-left-style: none;
>> border-right-style: solid;
>> }
>> }
>> Thanks.
>> P.S. Just in case: DRY is abbreviation from "Don't Repeat Yourself".
Received on Thursday, 5 January 2012 23:16:11 GMT

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