此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

CSSKeywordValue:value 属性

基线 2026
最近可用

自 2026年11月 起,此特性已在最新浏览器中得到支持。但在较旧的设备或浏览器中可能无法运行。

Want more browser support for this feature? Tell us why.

CSSKeywordValue 接口的 value 属性返回或设置 CSSKeywordValue 的值。

值

字符串。

异常

TypeError

如果 value 属性被设置为空字符串则抛出此异常。

示例

以下示例重设 CSS 的 display 属性为其默认值

js
let indicator = document.getElementById("indicator");
indicator.attributeStyleMap.set("display", new CSSKeywordValue("initial"));
indicator.attributeStyleMap.get("display").value; // 'initial'

规范

规范
CSS Typed OM Level 1
# dom-csskeywordvalue-value

浏览器兼容性