@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: 155Edge
12–138Not supported
139+Supportedsince Aug 7, 2025
Current: 154Firefox
✕Not supportedup to 157
Current: 157Safari
✕Not supportedup to 27
Current: 27MobileChrome Android
18–138Not supported
139+Supportedsince Aug 5, 2025
Current: 155Firefox Android
✕Not supportedup to 157
Current: 157Safari iOS
✕Not supportedup to 27
Current: 27How 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-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| CSSFunctionDeclarations | 139 | 139 | ✕ | ✕ | 139 | ✕ | ✕ |
| CSSFunctionDeclarations.style | 139 | 139 | ✕ | ✕ | 139 | ✕ | ✕ |
| CSSFunctionDescriptors | 139 | 139 | ✕ | ✕ | 139 | ✕ | ✕ |
| CSSFunctionDescriptors.result | 139 | 139 | ✕ | ✕ | 139 | ✕ | ✕ |
| CSSFunctionRule | 139 | 139 | ✕ | ✕ | 139 | ✕ | ✕ |
| CSSFunctionRule.getParameters | 139 | 139 | ✕ | ✕ | 139 | ✕ | ✕ |
| CSSFunctionRule.name | 139 | 139 | ✕ | ✕ | 139 | ✕ | ✕ |
| CSSFunctionRule.returnType | 139 | 139 | ✕ | ✕ | 139 | ✕ | ✕ |
| @function | 139 | 139 | ✕ | ✕ | 139 | ✕ | ✕ |
| @function.result | 139 | 139 | ✕ | ✕ | 139 | ✕ | ✕ |
| <dashed-function> | 139 | 139 | ✕ | ✕ | 139 | ✕ | ✕ |
| <type> | 139 | 139 | ✕ | ✕ | 139 | ✕ | ✕ |