craft

CSS if()

2026

Inline conditional values in CSS properties using the newif() function — no class toggles, no JavaScript, no media queries.

The card's border-radius, background color, and label all change based on a --val custom property set by the slider. Theif(style(...)) syntax checks the property value inline inside any CSS property.

Drag the slider