CSSNumericValue: div() method

Note: This feature is available in Web Workers.

The div() method of the CSSNumericValue interface divides the CSSNumericValue by the supplied value.

Syntax

js
div()
div(number1)
div(number1, number2)
div(number1, number2, /* …, */ numberN)

Parameters

number1, …, numberN Optional

Either a number or a CSSNumericValue.

Return value

A CSSMathProduct, or a CSSUnitValue if this and every argument are plain numbers, or all but one of them are.

Exceptions

TypeError

Thrown if an invalid type was passed to the method.

RangeError

Thrown if any of number1, …, numberN is, or resolves to, 0 or -0.

Examples

undefined

Basic usage

js
let mathProduct = CSS.px(24).div(CSS.percent(4));
// Prints "calc(24px / 4%)"
mathProduct.toString();

Specifications