Re: CSS3 Rule weights

24.05.2015, 18:42, "fantasai" <fantasai.lists@inkedblade.net>:
> On 05/22/2015 09:37 AM, Samwul Datong wrote:
>> š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.
>
> 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.

When criticizing/rejecting something, it's a good idea to provide an equivalent alternative.

For absolute `z-index` we currently have, such alternative could be specifying `z-index` for a selector _relative_ to another selector, but then you'd say that this could lead to undesirable circular dependencies. So absolute `z-index` is not an issue, it is just a practical option to solve real-world tasks.

With selector specificity, we currently have two options: specificity of a selector is defined either by the selector itself, or by the `!important` keyword.

With `!important`, we ALREADY have a (both specced and implemented) way to override default specificity, but it is unfortunately a very ROUGH way: we either have "0% of !important" (no `!important`) or "100% of !important" (`!important` itself). We can't specify, say, `50% of !important`.

As a web developer since 2002, I agree with Samwul:

web developers need a MORE FLEXIBLE way to control specificity, and adding a new property for this is a quite natural option that doesn't need any core-syntax-level changes.

Any tool can be used wrong way, but this alone is not a reason to disallow using it right way.

Received on Monday, 25 May 2015 18:40:04 UTC