Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

acos() — inverse cosine

acos() maps a cosine in the domain −1 through 1 to a principal angle from 0 through 180 degrees.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

acos(<calc-sum>)

acos() uses acos(<calc-sum>) and maps a cosine in the domain −1 through 1 to a principal angle from 0 through 180 degrees. The result keeps the type required by the property grammar, so the function participates in value computation rather than text substitution.

The example sets a real CSS property: acos(0) computes to 90deg, while the boundary case acos(2) computes to 0deg. The value comes from getComputedStyle and therefore exercises the computed-value stage.

Boundary behavior: an out-of-domain value produces NaN, which CSS censors to zero when it escapes a top-level calculation.

Examples

const a=document.createElement('div'),b=document.createElement('div');document.body.append(a,b);a.style.rotate='acos(0)';b.style.rotate='acos(2)';console.log('valid='+getComputedStyle(a).rotate+'; invalid='+getComputedStyle(b).rotate);

Result

valid=90deg; invalid=0deg

acos() maps a cosine in the domain −1 through 1 to a principal angle from 0 through 180 degrees.

Sources