- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Thu, 5 Jan 2012 15:30:30 -0800
- To: "Marat Tanalin | tanalin.com" <mtanalin@yandex.ru>
- Cc: www-style@w3.org
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. 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
Received on Thursday, 5 January 2012 23:31:18 UTC