CSSNumericValue: div() method
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Want more browser support for this feature? Tell us why.
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, …,numberNOptional-
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, …,numberNis, or resolves to, 0 or -0.
Examples
>Basic usage
js
let mathProduct = CSS.px(24).div(CSS.percent(4));
// Prints "calc(24px / 4%)"
mathProduct.toString();
Specifications
| Specification |
|---|
| CSS Typed OM Level 1> # dom-cssnumericvalue-div> |