<dashed-function>
Limited availability70% of usersExperimental
An experimental type of CSS function name that starts with two dashes (like '--foo()'). It's intended to be used for custom, user-defined functions in the future.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyComingNot in Firefox or Safari yet, so not every major browser supports it.
The old way and the modern waySee the snippet: Reusable CSS logic without Sass mixins →
Old way 9 lines
// Sass / SCSS
@use "sass:math";
@function fluid($min, $max) {
@return clamp( /* [!code --] */
$min,
calc(#{$min} + #{math.div($max - $min, 1rem)} * ((100vw - 20rem) / 60)),
$max
);
}Modern 10 lines
@function --fluid( /* */
--min <length>, /* */
--max <length> /* */
) returns <length> {
result: clamp( /* [!code ++] */
var(--min), /* [!code ++] */
50vi, /* [!code ++] */
var(--max) /* [!code ++] */
);
}See how modern your own CSS is.Check your CSS →
Quick example
/* Future CSS: Using a custom dashed-function */
.element {
--custom-anim: --my-logic(500ms);
}<dashed-function> browser support
BaselineLimited availabilityThis feature is not Baseline because it does not work in some of the most widely-used browsers.Not ready for production without a fallback.
Usage70%of people can use this30% use a browser without it.
Browsers
139+
139+Mobile
139+Android