Length 4:54CSS if() Function: Build a Theme-Aware Component
About this video
This tutorial shows how to use the experimental CSS if() function with a single custom property to switch a card component between light and dark themes. It covers conditional custom properties, fallbacks and semantic HTML, and checks WCAG AA contrast in CodePen.
What you’ll learn
- Write conditional custom properties with the CSS if() function
- Set fallbacks for a theme-aware card component
- Check WCAG AA contrast in light and dark modes










