Firefox Tomorrow

web api instance method

CSSNumericValue: sub() method

View on MDN ↗

The sub() method of the CSSNumericValue interface subtracts a supplied number from the CSSNumericValue.

Syntax

sub(number)

Parameters

Return value

A CSSMathSum

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.