<dashed-function> CSS type

Limited availability

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

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The <dashed-function> CSS data type represents the syntax used to call CSS custom functions, which are defined using the @function at-rule.

Syntax

A <dashed-function> value consists of the --function-name, followed by parentheses containing the function's arguments (for example, --my-function(30px, 3)).

You can include <dashed-function> values in place of regular CSS property values or property value components, in cases where you want to dynamically calculate the values based on function logic rather than providing static values.

In cases where you want to pass comma-containing values as arguments, you can do so by wrapping them in curly braces ({ }).

Examples

For more examples, see our Using CSS custom functions guide.

Basic <dashed-function> usage

This example shows a basic function that returns a semi-transparent version of the color passed to it.

HTML

The markup features a <p> containing some text content:

html
<p>Some content</p>

CSS

In our styles, we first define the CSS custom function. The function is called --transparent and accepts two parameters: a color and a numeric alpha channel value. Inside the function body, we use relative color syntax to transform the passed color into an oklch() color with an alpha channel equal to the passed alpha value; this becomes the function's result:

css
@function --transparent(--color <color>, --alpha <number>) {
  result: oklch(from var(--color) l c h / var(--alpha));
}

Next, we define a --base-color custom property with a value of #faa6ff on the :root element. We assign that property to be the value of the <p> element's border color, and then set its background-color value to equal a transparent version of the same color. This is done by setting the value to equal the <dashed-function> syntax, specifying the --transparent() function and passing it arguments of var(--base-color) and 0.8.

css
:root {
  --base-color: #faa6ff;
}

p {
  width: 50%;
  padding: 30px;
  border-radius: 20px;
  border: 3px solid var(--base-color);
  background-color: --transparent(var(--base-color), 0.8);
}

Result

Specifications

Specification
CSS Functions and Mixins Module
# using-custom-functions

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
<dashed-function>
Experimental
Chrome – Full support
Chrome 139 (Release date: 2025-08-05)
footnote Full support
Edge – Full support
Edge 139 (Release date: 2025-08-07)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 123 (Release date: 2025-10-28)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 139 (Release date: 2025-08-05)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 91 (Release date: 2025-08-19)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Full support
WebView Android 139 (Release date: 2025-08-05)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.

See also