Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. CSSNumericValue
  4. to()

CSSNumericValue: to() method

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Theto() method of theCSSNumericValue interface converts a numeric value from one unit toanother.

Syntax

js
to(unit)

Parameters

unit

The unit to which you want to convert.

Return value

ACSSMathSum.

Exceptions

SyntaxErrorDOMException

Thrown if an invalid type was passed to the method.

TypeError

Thrown if the passed values cannot be summed.

Examples

js
// Prints "0.608542cm"console.log(CSS.px("23").to("cm").toString());

Specifications

Specification
CSS Typed OM Level 1
# dom-cssnumericvalue-to

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp