<sign>
Newly availableSince 202591% of users
Returns the sign of a number: -1, 0 or 1. Useful for conditional calculations.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyModernIn every major browser since June 2025. Widely available around December 2027.
The old way and the modern waySee the snippet: Absolute values and direction without JavaScript math →
Old way 6 lines
.panel {
--offset: -1.5rem;
/* max() fallback for abs, or JS Math.abs before setting the var */
margin-inline-start: max(var(--offset), -1 * var(--offset));
}
/* JS: el.style.setProperty('--offset', Math.abs(raw) + 'rem'); */Modern 6 lines
.panel {
--offset: -1.5rem;
margin-inline-start: abs(var(--offset));
translate: calc(1rem * sign(var(--offset))) 0;
}
/* positive length + direction from one variable */See how modern your own CSS is.Check your CSS →
Quick example
.sign { color: calc(sign(-5) * 1); }<sign> browser support
BaselineNewly availableSince 2025 this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.Works in all modern browsers. May need a fallback for older browsers.
Usage91%of people can use this9% use a browser without it.
Browsers
138+
118+
15.4+
138+Mobile
138+Android
118+Android
15.4+iOS