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

Re: CSS Classes Custom - by Leonardo Lima

From: Andrea Rendine <master.skywalker.88@gmail.com>
Date: Wed, 8 Apr 2015 22:59:19 +0200
Message-ID: <CAGxST9=cL=WYO+KQH3gw=bajQdAUXys7-NtR=QVJQ-vw6Lz7gQ@mail.gmail.com>
To: Brian Kardell <bkardell@gmail.com>
Cc: Fran├žois REMY <francois.remy.dev@outlook.com>, Leonardo Lima <leonardo403@gmail.com>, www-style list <www-style@w3.org>
Fran├žois,
> 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.

Brian,
> 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
sees
#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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:30 UTC