We’re working on a html reader, and the content could be any html. We want to set a default font family if the font set in the content is not available.
For example,
<body style="font-family: A"><div style="font-family: B"></div></body>
If font B is not available, I prefer to use A to render. But we’re not able to change the style on div since it’s user content.
Or if it’s possible to change browser’s default fallback font?
2
Answers
You can set the CSS property as above, if B is valid, the browser will apply the last one, if not, the browser will ignore the invalid property.
That should be the default behavior. Font is calculated in this order getting the first availabe:
font-family: "Times New Roman", Times, serif;
).