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

@important instead of multiple !important

From: Marat Tanalin | tanalin.com <mtanalin@yandex.ru>
Date: Fri, 06 Jan 2012 02:29:34 +0400
To: www-style@w3.org
Message-Id: <524431325802574@web64.yandex.ru>
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 22:32:33 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:08 UTC