Performance: Fallback values
Fallback values affect how quickly the browser can render styles when a preferred value is unsupported or slow to load.
Jump into concepts and practice - no test required
font-family: 'CustomFont', Arial, sans-serif;
font-family: 'CustomFont';
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Single font without fallback | Minimal | 1 reflow after font loads | High paint cost due to delayed text rendering | [X] Bad |
| Font with fallback values | Minimal | Single reflow on initial paint | Lower paint cost, text visible immediately | [OK] Good |
p { color: var(--main-color, blue); }div { background-image: url('image.webp', 'image.png'); }--primary-color with a fallback to green if the variable is not defined. Which CSS rule correctly applies this fallback to the text color and background-color?