CSSNumericValue: div() 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 div() của giao diện CSSNumericValue chia CSSNumericValue cho giá trị được cung cấp.

Cú pháp

js
div(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 mathProduct = CSS.px("24").div(CSS.percent("4"));
// In ra "calc(24px / 4%)"
mathProduct.toString();

Thông số kỹ thuật

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

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