CSSStyleDeclaration cssText attribute
Definition and Usage
cssText
Sets or returns the value of the inline (inline) style declaration of the element.
Example
Example 1
Return the value of the inline style of the h1 element:
var elmnt = document.getElementsByTagName("h1")[0]; var x = elmnt.style.cssText;
Example 2
Set the text of the inline style declaration of the element:
document.getElementById("ex1").style.cssText = "color: blue;";
Syntax
Return the cssText attribute:
element.style.cssText
Set 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. |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |