CSSNumericValue:div() 方法

Limited availability

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

CSSNumericValue 接口的 div() 方法将 CSSNumericValue 除以提供的值。

语法

js
div(number)

参数

number

可以是一个数字或者一个 CSSNumericValue

返回值

一个 CSSMathProduct

异常

  • TypeError
    • :如果传递给方法的类型无效,则抛出错误。

示例

js
let mathProduct = CSS.px("24").div(CSS.percent("4"));
// 输出 "calc(24px / 4%)"
mathProduct.toString();

规范

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

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
div

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.