cssText
特性为
CSSRule
interface returns the actual text of a
CSSStyleSheet
style-rule.
注意:
Do not confuse this property with element-style
CSSStyleDeclaration.cssText
.
Be aware that this property can no longer be set directly, as it is
now specified
到
functionally
modify-only, and silently so. In other words, attempting to set it
does absolutely nothing
, and doesn't even omit a warning or error. Furthermore, it has no settable sub-properties. Therefore, to modify it, use the stylesheet's
cssRules
[index]
properties
.selectorText
and
.style
(or its sub-properties). See
Using dynamic styling information
了解细节。
string = cssRule.cssText
<style>
body {
background-color: darkblue;
}
</style>
<script>
var stylesheet = document.styleSheets[0];
alert(stylesheet.cssRules[0].cssText); // body { background-color: darkblue; }
</script>
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Object Model (CSSOM)
The definition of 'CSSRule: cssText' in that specification. |
工作草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
cssText
|
Chrome 1 | Edge 12 | Firefox 1 | IE ? | Opera Yes | Safari Yes | WebView Android Yes | Chrome Android 18 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 1.0 |
完整支持
兼容性未知
CSSRule
cssText
parentStyleSheet
AnimationEvent
CSS
CSSConditionRule
CSSGroupingRule
CSSKeyframeRule
CSSKeyframesRule
CSSMediaRule
CSSNamespaceRule
CSSPageRule
CSSRuleList
CSSStyleDeclaration
CSSStyleRule
CSSStyleSheet
CSSSupportsRule
CaretPosition
LinkStyle
MediaQueryList
MediaQueryListListener
Screen
StyleSheet
StyleSheetList
TransitionEvent