MDN self-hosted library · e01.org

CSSMathNegate: value property

CSS Typed Object Model API

Open notebook · 1 cells web-api-instance-property upstream source

CSS Typed Object Model API

The value read-only property of the CSSMathNegate interface returns the CSSNumericValue that is being negated.

This is the value passed to the constructor, converted to a CSSNumericValue if it isn't one already. If a plain number was passed to the constructor the value returned by this property is the passed value wrapped in a CSSUnitValue with unit: "number".

Value

A CSSNumericValue or one of its derived types.

Examples

Basic usage

The following code creates a CSSMathNegate object, then reads its value.

In this case, we passed CSS.px(10), so value is a CSSUnitValue. Passing a composite expression such as CSS.px(10).add(CSS.percent(5)) would result in value returning a CSSMathSum.

const negated = new CSSMathNegate(CSS.px(10));

console.log(negated.value); // CSSUnitValue {value: 10, unit: "px"}

Specifications

Browser compatibility

See also

  • CSSMathInvert.value