CSSStyleDeclaration cssText Property
Example
Return the value of the inline style of a H1 element:
var elmnt = document.getElementsByTagName("h1")[0];
var x = elmnt.style.cssText;
Try it Yourself »
Description
The cssText property sets or returns the value of an element's inline style declaration.
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 text of the element's inline style declaration:
document.getElementById("ex1").style.cssText = "color: blue;";
Try it Yourself »
❮ CSSStyleDeclaration Object