Arithmetic Functions

Arithmetic Functions that are supported.

You can use any of the arithmetic functions implemented in the java.lang.Math class (http://download.oracle.com/javase/6/docs/api/java/lang/Math.html).

In addition to that, the following functions are available:

Syntax Details
oxy_add (param1, ... , paramN, 'returnType') Adds the values of all parameters from param1 to paramN.
oxy_subtract (param1, param2, ... , paramN, 'returnType') Subtracts the values of parameters param2 to paramN from param1.
oxy_multiply (param1, ... , paramN, 'returnType') Multiplies the values of parameters from param1 to paramN.
oxy_divide (param1, param2, 'returnType') Performs the division of param1 to param2.
oxy_modulo (param1, param2, 'returnType') Returns the reminder of the division of param1 to param2.

Note

The returnType can be 'integer', 'number', or any of the supported CSS measuring types.

If we have an image with width and height specified on it we can compute the number of pixels on it:

image:before{
 content: "Number of pixels: " oxy_multiply(attr(width), attr(height), "px");
}

Was this helpful?