cssText Property

Internet Development Index

Sets or retrieves the persisted representation of the style rule.

Syntax

object.cssText [ = sTxt ]

Possible Values

sTxtString that specifies or receives the text.

The property is read/write. The property has no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.

Example

This example uses the cssText property to retrieve the Cascading Style Sheets (CSS) style set on an object.

<P ID=oPara STYLE="color:'green'; font-weight:bold">
This is the test paragraph.</P>
:
<BUTTON onclick="alert(oPara.style.cssText)">
Get CSS attributes</BUTTON>
This feature requires Microsoft® Internet Explorer 5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

There is no public standard that applies to this property.

Applies To

runtimeStyle, style, styleSheet