CSSStyleDeclaration cssText Property
Examples
Return the inline style value of the h1 element:
var elmnt = document.getElementsByTagName("h1")[0];
var x = elmnt.style.cssText;
Try it yourself »
Definition and Usage
The cssText property is used to set or return the inline style declared by 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 the specified element:
document.getElementById("ex1").style.cssText = "color: blue;";
Try it yourself »
CSS CSSStyleDeclaration