cssText
Summary
Gets or sets the textual representation of a style sheet.
Property of css/cssom/styleSheetcss/cssom/styleSheet
Syntax
var cssText = stylesheet.cssText;
stylesheet.cssText = cssText;
Return Value
Returns an object of type StringString
The textual representation of the style sheet.
Examples
This example uses the cssText property to retrieve the CSS style set on an object.
<p id="oPara" style="color: green; font-weight: bold;">
This is the test paragraph.</p>:
<button onclick="console.log(document.getElementById('oPara').style.cssText)">Get CSS attributes</BUTTON>
Notes
This property reflects the current state of the style sheet and not its initial value.
Related specifications
- DOM Level 2 Style
- Recommendation
See also
Related articles
CSSOM
cssText
Related pages
- CSSStyleDeclarationCSSStyleDeclaration
- currentStylecurrentStyle
- runtimeStyleruntimeStyle
- stylestyle
- styleSheetstyleSheet
- CSSFontFaceRuleCSSFontFaceRule
- CSSImportRuleCSSImportRule
- CSSMediaRuleCSSMediaRule
- CSSNamespaceRuleCSSNamespaceRule
- CSSRuleCSSRule
- pagepage
- rulerule
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]