<if>

Experimental

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.

Quick 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 67% global usage

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Not ready for production without a fallback.

137+
137+
ESC