web api instance method
CSSNumericValue: sub() method
The sub() method of the
CSSNumericValue interface subtracts a supplied number from the
CSSNumericValue.
Syntax
sub(number)
Parameters
number- : Either a number or a
CSSMathSum.
- : Either a number or a
Return value
Exceptions
TypeError- : Thrown if an invalid type was passed to the method.
Examples
let mathSum = CSS.px("23")
.sub(CSS.percent("4"))
.sub(CSS.cm("3"))
.sub(CSS.in("9"));
// Prints "calc(23px - 4% - 3cm - 9in)"
console.log(mathSum.toString());
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.