From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/api/cssrule/csstext/index.html | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 files/ja/web/api/cssrule/csstext/index.html (limited to 'files/ja/web/api/cssrule/csstext') diff --git a/files/ja/web/api/cssrule/csstext/index.html b/files/ja/web/api/cssrule/csstext/index.html new file mode 100644 index 0000000000..7221b5508c --- /dev/null +++ b/files/ja/web/api/cssrule/csstext/index.html @@ -0,0 +1,42 @@ +--- +title: CSSRule.cssText +slug: Web/API/CSSRule/cssText +tags: + - API + - CSSOM + - NeedsCompatTable + - Property + - Referrence +translation_of: Web/API/CSSRule/cssText +--- +

要素スタイル {{domxref("CSSStyleDeclaration.cssText")}} と混同しないでください。

+ +
{{APIRef("CSSOM") }}
+ +

概要

+ +

cssText は、{{domxref("CSSStyleSheet")}} スタイル規則の実際のテキストを返します。

+ +

補足: 仕様に明記 されたとおり、機能暗黙的に 変更するだけで、直接設定することはできません。これに設定しようとしても、警告もエラーもなく、絶対に何も起こりません。さらに、設定可能なサブプロパティもありません。そのため、これを変更するには、スタイルシートの {{domxref("CSSRuleList","cssRules")}}[index] プロパティおよび {{domxref("CSSStyleRule.selectorText",".selectorText")}}、{{domxref("CSSStyleRule.style",".style")}} (または、そのサブプロパティ) を使用してください。詳細は、動的なスタイル情報の利用 を参照してください。

+ +

構文

+ +
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>
+
+
+ +

仕様書

+ + -- cgit v1.2.3-54-g00ecf