CSSKeywordValue
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
TheCSSKeywordValue interface of theCSS Typed Object Model API creates an object to represent CSS keywords and other identifiers.
The interface instance name is astringifier meaning that when used anywhere a string is expected it will return the value ofCSSKeyword.value.
In this article
Constructor
CSSKeywordValue()Creates a new
CSSKeywordValueobject.
Instance properties
CSSKeywordValue.valueReturns or sets the value of the
CSSKeywordValue.
Instance methods
Inherits methods fromCSSStyleValue.
Examples
The following example resets the CSSdisplay property to its defaults, setting the inlinestyle attribute tostyle="display: initial" if viewed in thedeveloper tools inspector.
#myElement { display: flex;}<div> Check the developer tools to see the log in the console and to inspect the style attribute on this div.</div>js
let myElement = document.getElementById("myElement").attributeStyleMap;myElement.set("display", new CSSKeywordValue("initial"));console.log(myElement.get("display").value); // 'initial'Specifications
| Specification |
|---|
| CSS Typed OM Level 1> # keywordvalue-objects> |