Is it valid to have the style on an element have an inherit value in the font family for when the font is missing?

708 views html
4

If I have a page that this HTML

<body >
    <span >Hello World</span>
</body>

Is it valid to set the font family of the span to Segue, inherit to allow it to inherit the parent font if the first font listed is unavailable on the system?

<body >
    <span >Hello World</span>
</body>

It seems to work in the browser (Firefox) but Firefox's own debug tools are saying it's invalid.

In other words, is it OK to write font-family: AnyFont, inherit?

Update:
Using inherit does NOT work.

The question may now be, how to get a span to inherit the font when the font is not available.

answered question

1 Answer

6

It's invalid. inherit may only exist on its own in a property declaration.

While the entire declaration is in fact ignored, it appears to work because font-family is inherited by default anyway.

Without using custom properties, it's not possible for an element to fall back to its parent's font stack without respecifying the entire stack as fallbacks.

posted this

Have an answer?

JD

Please login first before posting an answer.