- From: Marat Tanalin | tanalin.com <mtanalin@yandex.ru>
- Date: Fri, 06 Jan 2012 03:36:10 +0400
- To: Tab Atkins Jr. <jackalmage@gmail.com>
- Cc: www-style@w3.org
06.01.2012, 03:30, "Tab Atkins Jr." <jackalmage@gmail.com>: > On Thu, Jan 5, 2012 at 2: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; >> } >> } > > !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. > 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). > > ~TJ 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.
Received on Thursday, 5 January 2012 23:44:26 UTC