CSSMathSum
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
The CSSMathSum
interface of the CSS Typed Object Model API represents the result obtained by calling add()
, sub()
, or toSum()
on CSSNumericValue
.
A CSSMathSum is the object type returned when the StylePropertyMapReadOnly.get()
method is used on a CSS property whose value is created with a calc()
function.
Constructor
CSSMathSum()
Experimental-
Creates a new
CSSMathSum
object.
Instance properties
CSSMathSum.values
-
Returns a
CSSNumericArray
object which contains one or moreCSSNumericValue
objects.
Static methods
The interface may also inherit methods from its parent interface, CSSMathValue
.
Instance methods
The interface may also inherit methods from its parent interface, CSSMathValue
.
Examples
We create an element with a width
determined using a calc()
function, then console.log()
the operator
and values
, and dig into the values a bit.
We assign a width
We add the JavaScript
The specification is still evolving. In the future we may write the last three lines as:
Specifications
Specification |
---|
CSS Typed OM Level 1 # cssmathsum |