round(), mod() & rem() snap lab

The teal point moves freely. The orange node is placed by CSS alone with round(). Drag the point, tap the grid or use the arrow keys.

0,0
←↑→↓ move · Shift = bigger steps

mod() vs rem() on x

mod(x, step)0px
rem(x, step)0px

Rounding strategy

40px

The CSS doing it


      

Computed by the browser (x, y)

raw
0, 0
round()
0, 0