← Back to release summary

CSS Sign-Related Functions: abs(), sign()

Category
CSS
Type
Chromium catches up
Status
In developer trial (Behind a flag) (Chrome 138)
Intent stage
None

Summary

The sign-related functions ​abs() and sign() ​compute various functions related to the sign of their argument. The abs(A) function contains one calculation A, and returns the absolute value of A, as the same type as the input: if A’s numeric value is positive or 0⁺, just A again; otherwise -1 * A. The sign(A) function contains one calculation A, and returns -1 if A’s numeric value is negative, +1 if A’s numeric value is positive, 0⁺ if A’s numeric value is 0⁺, and 0⁻ if A’s numeric value is 0⁻. The return type is a <number>, made consistent with the input calculation’s type.

Standards & signals

View on chromestatus.com