W3C home > Mailing lists > Public > www-style@w3.org > May 2015

Re: CSS3 Rule weights

From: fantasai <fantasai.lists@inkedblade.net>
Date: Sun, 24 May 2015 11:38:23 -0400
Message-ID: <5561F06F.6020701@inkedblade.net>
To: Samwul Datong <emarketing@passagegoldtravels.com>, www-style@w3.org
On 05/22/2015 09:37 AM, Samwul Datong wrote:
> CSS3 uses the cascading set of rules and the !important keyword to determine which style rule among many conflicting rules
> should apply to an object/item.
>
> However, with the heavy use of classes in css frameworks, the current system might not be totally appropriate to address all
> use cases.
>
> I'm proposing a new simple css rule-weight property which can be added to any set of rules. The simple idea is that a set of
> rules with a heavier weight should take precedence over lighter weights.
>
> e.g.
> .class1 {color:blue; font-size:1em; rule-weight:10}
> .class2 {color:red; background-color:#b2b2b2; text-align:center; rule-weight:50}
>
> <div class="class1 class2">Hello World</div>
>
> Here, for any rules defined in both class1 and class2, the rules in class2 would take precedence because class2 has a higher
> rule-weight than class1.
>
> This should make working with stylesheets simpler and easier to understand

Random numerical constants like this generally make a mess of things,
and I'm guessing people will just throw random large numbers at their
style sheets in order to "fix" some problem that they didn't take the
time to understand. We already have a similar issue with z-index
(people set it to MAX_INT when they want something to "win" the top
position), and that's even a simpler problem than cascading.

~fantasai
Received on Sunday, 24 May 2015 15:38:53 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:54 UTC