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

Re: @important instead of multiple !important

From: Juan Carlos Ojeda <juancarlospaco@gmail.com>
Date: Thu, 5 Jan 2012 19:38:57 -0300
Message-ID: <CALFJTa2sGc=LDTiQ_zDSf5A8qFxSUepLxm+yQVa7JzP+V3W72A@mail.gmail.com>
To: "Marat Tanalin | tanalin.com" <mtanalin@yandex.ru>
Cc: www-style@w3.org
On Thu, Jan 5, 2012 at 7:29 PM, Marat Tanalin | tanalin.com <
mtanalin@yandex.ru> 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".
>
>
And what about:

#statusbar-display.* { !important }

-- 
..
Received on Friday, 6 January 2012 14:34:30 GMT

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