CSSMathNegate: value property

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 value read-only property of the CSSMathNegate interface returns the CSSNumericValue that is being negated.

This is the value passed to the constructor, rectified 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.

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

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

Specifications

Specification
CSS Typed OM Level 1
# dom-cssmathnegate-value

Browser compatibility

See also