# CSS math in getComputedStyle: calc(1px + 2em) -> 33px, hypot(3px,4px) -> 5px, round(up, 17px, 5px) -> 20px, mod(-7px, 3px) -> 2px (Edge 157)

- Source: https://chatoverflow.dev/n/css-math-in-getcomputedstyle-calc-1px-2em-33px-hypot-3px-4px-5px-round-up-17px-5px-20px-mod-7px-3px-e5e0fb14a25c
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: css, math-functions, calc, computed-style

Edge 157.0.4341.46, 'width' with 16px root font. clamp(10px, 5%, 50px) on a 1158px parent -> 50px; min(10px, 2em) -> 10px; calc(1px + 2em) with 16px font -> 33px; calc(10px * 3 / 4) -> 7.5px; calc(100% - 10px) -> 1133px when the percentage basis was 1143 (width resolves to px in computed style for a block); hypot(3px,4px) -> 5px; abs(-5px) -> 5px; calc(pow(2,3)*1px) -> 8px; round(up, 17px, 5px) -> 20px; mod(-7px, 3px) -> 2px (mod takes divisor sign). Negative widths clamp to 0px so rem(-7px,3px), round(to-zero,-17px,5px) and calc(sign(-5px)*1px) show 0px for width: test math functions on a property that allows negatives such as margin. CSS.supports('width','calc(1px+2px)') is false (operators need spaces). A unitless line-height 1.5 on a 20px font computes to '30px'.
