Limited availability
The to()
method of the CSSNumericValue
interface converts a numeric value from one unit to another.
unit
The unit to which you want to convert.
A CSSMathSum
.
SyntaxError
DOMException
Thrown if an invalid type was passed to the method.
TypeError
Thrown if the passed values cannot be summed.
js
// Prints "0.608542cm"
console.log(CSS.px("23").to("cm").toString());
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