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)
"Verdana, sans-serif"
– Wennerholnfont-family: Verdana, sans-serif;
but with variables. – Monday--font: verdana, sans-serif;
andfont-family: var(--font)
right? The comma syntax mentioned in question is reserved for fallback values if I remember right. (Edit: Maybe you are correct and OP is trying to setVerdana, sans-serif
as the fallback but it is unclear.) – Ruben