A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/en-US/docs/Web/API/CSSMathValue below:

CSSMathValue - Web APIs | MDN

CSSMathValue

Limited availability

The CSSMathValue interface of the CSS Typed Object Model API a base class for classes representing complex numeric values.

CSSStyleValue CSSNumericValue CSSMathValue Interfaces based on CSSMathValue

Below is a list of interfaces based on the CSSMathValue interface.

Instance properties
CSSMathValue.operator

Indicates the operator that the current subtype represents.

Static methods

The interface may also inherit methods from its parent interface, CSSNumericValue.

Instance methods

The interface may also inherit methods from its parent interface, CSSNumericValue.

Examples

We create an element with a width determined using a calc() function, then console.log() the operator.

We assign a width with a calculation

div {
  width: calc(30% - 20px);
}

We add the JavaScript

const styleMap = document.querySelector("div").computedStyleMap();

console.log(styleMap.get("width")); // CSSMathSum {values: CSSNumericArray, operator: "sum"}
console.log(styleMap.get("width").operator); // 'sum'
console.log(styleMap.get("width").values[1].value); // -20

The CSSMathValue.operator returns "sum" because styleMap.get("width").values[1].value ); is -20: adding a negative number.

Specifications Browser compatibility

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4