How can one use commas in the fallback value of a CSS variable?
E.g. this is fine: var(--color, #f00)
, but this is weird var(--font-body, Verdana, sans-serif)
.
The idea is to be able to set a font-family
using a variable with a fallback value of say Verdana, sans-serif
.
Edit: This actually works pretty well for browsers that support CSS properties, but the issue seems to come from Google Polymer's polyfills.
For future reference, I ended up using variables for both the font and the font family fallback like so (seems to be the cleanest way of doing it for now):
font-family: var(--font-body, Verdana), var(--font-body-family, sans-serif)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…