草案
此页面不完整。

这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

parse() 方法在 CSSNumericValue interface converts a value string into an object whose members are value and the units.

句法

var cssNumericValue = CSSNumericValue.parse(cssText);
					

参数

cssText

a string containing numeric and unit parts.

返回值

A CSSNumericValue .

异常

SyntaxError

TBD

范例

The following returns a CSSUnitValue object with a unit property equal to "px" value property equal to 42 .

let numValue = CSSNumericValue.parse("42.0px");
					

规范

规范 状态 注释
CSS Typed OM Level 1
The definition of 'parse' in that specification.
工作草案 初始定义。

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
parse Chrome 66
66
Not exposed to PaintWorklet.
Edge 79
79
Not exposed to PaintWorklet.
Firefox No IE No Opera 53
53
Not exposed to PaintWorklet.
Safari No WebView Android 66
66
Not exposed to PaintWorklet.
Chrome Android 66
66
Not exposed to PaintWorklet.
Firefox Android No Opera Android 47
47
Not exposed to PaintWorklet.
Safari iOS No Samsung Internet Android 9.0
9.0
Not exposed to PaintWorklet.

图例

完整支持

完整支持

不支持

不支持

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

见实现注意事项。

元数据

  • 最后修改:
  1. CSSNumericValue
  2. 特性
    1. type
  3. 方法
    1. add()
    2. div()
    3. equals()
    4. max()
    5. min()
    6. mul()
    7. parse()
    8. sub()
    9. sum()
    10. to()
    11. toSum()

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1