Re: [CSS21] Errata to disallow 'inherit' after comma in 'font-family'

On Sat, May 5, 2012 at 6:55 AM, Lea Verou <leaverou@gmail.com> wrote:
> I was wondering for a while if I should post this, as it seems there are
> technical & backwards compatibility reasons behind the decision (which I
> have to admit, I haven’t followed very closely).
> FWIW, allowing `inherit` after the font families is tremendously useful. It
> allows authors to set the base font family in the root element, and override
> it only when alternative fonts are present in the system. If they are not,
> it falls back to the root font-family, without having to needlessly repeat
> it and change it in multiple places when the base font-family is changed. Of
> course, there are a number of ways to work around this use case (variables,
> @font-face alias of local() fonts etc) but I like its simplicity and
> elegance. I still remember how weird I found it that it wasn’t allowed when
> I was still new to CSS. So, by extrapolating my own experience, I’d
> speculate that forbidding it, makes learning harder.

It *doesn't* allow that, though.  That's a *potential* thing that it
could do, but no browser does so, and no spec describes that behavior.
 It's also inconsistent with the behavior of 'inherit' in every other
property, including other list-valued properties that could
potentially benefit in the same way.

All browsers, when they happen to consider such a declaration valid,
simply treat it as part of the font's name (in other words, it's
treated like any other keyword, and not given any special meaning).
They're inconsistent with each other on when such a thing is valid,
though, and in general this is inconsistent with the overall rule that
'inherit' can only be used as the sole value of a property.

Since no spec or browser covers the behavior you describe, right now
you actually *want* the use of 'inherit' to be invalid. That way, it's
more likely that we can change the behavior of that usage to what you
describe.

(I doubt we'd do so, since Vars handles this sort of thing generally,
and @font-face handles this for 'font-family' specifically, but
still.)

~TJ

Received on Saturday, 5 May 2012 14:53:33 UTC