Re: CSS Classes Custom - by Leonardo Lima

> if you don't want to set the exact same set of properties all the time
If you don't want the exact same ruleset to be recycled, then a placeholder
is the bad choice I think.
This is useful for recycling "something". At least the properties, as
anything can be overwritten however.

> Tab talks about this in example 5 of that document, it does explain how
specificity works
In the document, the specificity logic is dropped altogether and Tab
himself writes
"effectively ignoring specificity entirely, then apply them via longer,
much more specific selectors [...] This can allow an author to avoid many
of the specificity problems of using IDs in rules"
There's nothing really decent. Specificity is a part of normal way of
intending CSS, as cascading and inheritance are.
There's a whole huge array of new selectors which take care of the "need to
avoid specificity problems".

And I don't think anybody can be defined a naive author just because s/he
#sidebar { @extend .red-text; }
and s/he does not consider that actually #sidebar is no longer relevant as
an id selector.

But there's more.
In this case:

#sidebar {
  @extend .red-text;
  font-weight: bold;
div {
  @extend .blue-text;
  font-weight: normal;

what happens? The extension rule is evaluated according to its position in
the CSS, but the simple font-weight rule is evaluated according to
specificity. Do you see that it's deeply counter-intuitive?

No, I hope that part is reconsidered. Cloned ruleset should have no
specificity at all, in order to avoid these "trivial" errors, so there will
be no conflict between "outer" selectors and "inner" selectors, IMHO.

Received on Wednesday, 8 April 2015 20:59:46 UTC