CSS if()
- 1 · Test the condition
style(--status: complete) queries a custom property on the element.
- 2 · Choose the first true
Its value, 32px, is substituted inside padding.
- 3 · Keep a final option
else: 8px is used when no earlier condition is true.
if(condition: value; else: alternative) takes the place of a CSS value. It does not create rules or execute JavaScript statements. Separate branches with semicolons and each condition from its value with a colon. The final semicolon is optional.