Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The mod()
CSS function returns a modulus left over when the first parameter is divided by the second parameter, similar to the JavaScript remainder operator (%
). The modulus is the value left over when one operand, the dividend, is divided by a second operand, the divisor. It always takes the sign of the divisor.
For example, the CSS
mod(21, -4)
function returns the remainder of-1
. When dividing 21 by -4, the result is 5 with a remainder of -1. The full calculation is21 / -4 = -4 * 5 - 1
.