<if>
An experimental function that allows you to apply different values based on a condition (like a media query or a variable state) directly within a property value.
This is an experimental technology. The syntax and behavior are still subject to change.
Syntax
/* Usage Example */
button {
/* Experimental: change padding based on a wide screen variable */
padding: if(var(--is-wide): 1rem 2rem; else: 0.5rem 1rem);
}
<if> Browser support
Limited availability
Since
2020 67% global usage
This feature is not Baseline because it does not work in some of the most widely-used browsers.
137+
137+