Firefox Tomorrow

web api instance method

CSSNumericValue: add() method

View on MDN ↗

The add() method of the CSSNumericValue interface adds a supplied number to the CSSNumericValue.

Syntax

add(number)

Parameters

Return value

A CSSMathSum

Exceptions

  • TypeError
    • : Thrown if an invalid type was passed to the method.

Examples

let mathSum = CSS.px("23")
  .add(CSS.percent("4"))
  .add(CSS.cm("3"))
  .add(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.