CSSNumericValue: mul() method

Limited availability

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

Phương thức mul() của giao diện CSSNumericValue nhân CSSNumericValue với giá trị được cung cấp.

Cú pháp

js
mul(number)

Tham số

number

Một số hoặc một CSSNumericValue.

Giá trị trả về

Một CSSMathProduct.

Ngoại lệ

TypeError

Được ném ra nếu kiểu không hợp lệ được truyền vào phương thức.

Ví dụ

js
let mathSum = CSS.px("23")
  .mul(CSS.percent("4"))
  .mul(CSS.cm("3"))
  .mul(CSS.in("9"));
// In ra "calc(23px * 4% * 3cm * 9in)"
console.log(mathSum.toString());

Thông số kỹ thuật

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

Tương thích trình duyệt