Easy Tutorial
❮ Prop Win Top Prop Style Textdecorationstyle ❯

CSSStyleDeclaration cssText Property

CSS CSSStyleDeclaration

Example

Return the inline style value of an h1 element:

var elmnt = document.getElementsByTagName("h1")[0];
var x = elmnt.style.cssText;

Definition and Usage

The cssText property is used to set or return the inline style declarations of 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: 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;";

CSS CSSStyleDeclaration

❮ Prop Win Top Prop Style Textdecorationstyle ❯