CSSStyleDeclaration cssText Property
Example
Return the inline style value of an h1 element:
var elmnt = document.getElementsByTagName("h1");
var x = elmnt.style.cssText;
Definition and Usage
The cssText property sets or returns the inline style declared for an element.
Browser Support
| Property | |||||
|---|---|---|---|---|---|
| cssText | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the cssText property:
element.style.cssText
Set the cssText property:
element.style.cssText = style
Technical Details
| DOM Version: | Level 2 Style CSS |
| Return Value: | A String, representing the inline style of the specified element. |
More Examples
Example
Set the inline style of a specified element:
document.getElementById("ex1").style.cssText = "color: blue;";
YouTip