aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/stylesheet/media/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/stylesheet/media/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/ja/web/api/stylesheet/media/index.html')
-rw-r--r--files/ja/web/api/stylesheet/media/index.html57
1 files changed, 57 insertions, 0 deletions
diff --git a/files/ja/web/api/stylesheet/media/index.html b/files/ja/web/api/stylesheet/media/index.html
new file mode 100644
index 0000000000..6c3de44d29
--- /dev/null
+++ b/files/ja/web/api/stylesheet/media/index.html
@@ -0,0 +1,57 @@
+---
+title: StyleSheet.media
+slug: Web/API/StyleSheet/media
+tags:
+ - API
+ - CSSOM
+ - Media
+ - StyleSheet
+ - プロパティ
+translation_of: Web/API/StyleSheet/media
+---
+<div>{{APIRef("CSSOM")}}</div>
+
+<p><strong>StyleSheet.media</strong> は、スタイル情報の対象として想定するメディアを指定します。これは読み取り専用で配列風の <code>MediaList</code> オブジェクトであり、 <code>deleteMedium()</code> で削除したり <code>appendMedium()</code> で追加したりすることができます。</p>
+
+<h2 id="Example" name="Example">例</h2>
+
+<pre>&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;link rel="stylesheet" href="document.css" type="text/css" media="screen" /&gt;
+&lt;style rel="stylesheet" type="text/css" media="screen, print"&gt;
+body { background-color: snow; }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;script&gt;
+for (var iSheetIndex = 0; iSheetIndex &lt; document.styleSheets.length; iSheetIndex++)
+ {
+ console.log('document.styleSheets[' + String(iSheetIndex) + '].media: ' +
+ JSON.stringify(document.styleSheets[iSheetIndex].media));
+ if (iSheetIndex === 0)
+ document.styleSheets[iSheetIndex].media.appendMedium('handheld');
+ if (iSheetIndex === 1)
+ document.styleSheets[iSheetIndex].media.deleteMedium('print');
+ console.log('document.styleSheets[' + String(iSheetIndex) + '].media: ' +
+ JSON.stringify(document.styleSheets[iSheetIndex].media));
+ }
+/*
+will log:
+document.styleSheets[0].media: {"0":"screen"}
+document.styleSheets[0].media: {"0":"screen","1":"handheld"}
+document.styleSheets[1].media: {"0":"screen","1":"print"}
+document.styleSheets[1].media: {"0":"screen"}
+*/
+&lt;/script&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
+</pre>
+
+<h2 id="Specification" name="Specification">仕様書</h2>
+
+<p>DOM Level 2 Styles - STYLESHEET</p>
+
+<p><a href="https://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html#StyleSheets-MediaList">W3C: Document Object Model Style Sheets - MediaList</a></p>