coderef

@functionLimited availability

The @function CSS at-rule defines a custom function that takes CSS values or custom properties as arguments, and returns a CSS value. It can be based on conditional logic such as by using the @media at-rule.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–138Not supported
139+Supportedsince Aug 5, 2025
Current: 155
Edge
12–138Not supported
139+Supportedsince Aug 7, 2025
Current: 154
Firefox
✕Not supportedup to 157
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
18–138Not supported
139+Supportedsince Aug 5, 2025
Current: 155
Firefox Android
✕Not supportedup to 157
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Firefox, Safari, Firefox Android, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: CSSFunctionDeclarations.

Feature detection

JS · check before using
if ("CSSFunctionDeclarations" in globalThis) {
  // CSSFunctionDeclarations is available
} else {
  // load a polyfill or use a fallback
}

Sub-features

Support for each part of the feature (12). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
CSSFunctionDeclarations139139✕✕139✕✕
CSSFunctionDeclarations.style139139✕✕139✕✕
CSSFunctionDescriptors139139✕✕139✕✕
CSSFunctionDescriptors.result139139✕✕139✕✕
CSSFunctionRule139139✕✕139✕✕
CSSFunctionRule.getParameters139139✕✕139✕✕
CSSFunctionRule.name139139✕✕139✕✕
CSSFunctionRule.returnType139139✕✕139✕✕
@function139139✕✕139✕✕
@function.result139139✕✕139✕✕
<dashed-function>139139✕✕139✕✕
<type>139139✕✕139✕✕