aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/cssstylesheet
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
commit074785cea106179cb3305637055ab0a009ca74f2 (patch)
treee6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/ru/web/api/cssstylesheet
parentda78a9e329e272dedb2400b79a3bdeebff387d47 (diff)
downloadtranslated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz
translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2
translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip
initial commit
Diffstat (limited to 'files/ru/web/api/cssstylesheet')
-rw-r--r--files/ru/web/api/cssstylesheet/index.html133
1 files changed, 133 insertions, 0 deletions
diff --git a/files/ru/web/api/cssstylesheet/index.html b/files/ru/web/api/cssstylesheet/index.html
new file mode 100644
index 0000000000..1b2da99134
--- /dev/null
+++ b/files/ru/web/api/cssstylesheet/index.html
@@ -0,0 +1,133 @@
+---
+title: CSSStyleSheet
+slug: Web/API/CSSStyleSheet
+translation_of: Web/API/CSSStyleSheet
+---
+<div>{{APIRef("CSSOM")}}</div>
+
+<p><strong><code>CSSStyleSheet</code></strong> interface представляет одну <a href="/en-US/docs/Web/CSS">CSS</a> таблицу стилей. CSS таблица наследует свойства и методы от родителя, {{domxref("StyleSheet")}}.</p>
+
+<p>Таблица стилей состоит (правил)<em>{{domxref("CSSRule", "rules", "", 1)}}</em>, таких как <em>{{domxref("CSSStyleRule", "style rules", "", 1)}}</em><em> </em>("<code>h1,h2 { font-size: 16pt }"</code>),<em>и различных</em> (<code>@import</code>, <code>@media</code>, ...), etc. <strong><code>CSSStyleSheet</code></strong> interface позволяет получать и изменять список правил в таблице стилей.</p>
+
+<p>Смотрите {{anch("Notes")}} секцию о  различных способах получения <strong><code>CSSStyleSheet</code></strong> object.</p>
+
+<h2 id="Properties">Properties</h2>
+
+<p><em>Inherits properties from its parent, {{domxref("StyleSheet")}}.</em></p>
+
+<dl>
+ <dt id="cssRules">{{domxref("CSSStyleSheet.cssRules")}}</dt>
+ <dd>Returns a live {{domxref("CSSRuleList")}}, listing the {{domxref("CSSRule")}} objects in the style sheet.<br>
+ This is normally used to access individual rules like this:
+ <pre><code>   styleSheet.cssRules[i] // where i = 0..cssRules.length-1</code></pre>
+ To add or remove items in <code>cssRules</code>, use the <code>CSSStyleSheet</code>'s <code>deleteRule()</code> and <code>insertRule()</code> methods, described below.</dd>
+ <dt id="ownerRule">{{domxref("CSSStyleSheet.ownerRule")}}</dt>
+ <dd>If this style sheet is imported into the document using an {{cssxref("@import")}} rule, the <code>ownerRule</code> property will return that {{domxref("CSSImportRule")}}, otherwise it returns <code>null</code>.</dd>
+</dl>
+
+<h2 id="Methods">Methods</h2>
+
+<p><em>Inherits methods from its parent, {{domxref("Stylesheet")}}.</em></p>
+
+<dl>
+ <dt id="deleteRule">{{domxref("CSSStyleSheet.deleteRule()")}}</dt>
+ <dd>Deletes a rule at the specified position from the style sheet.</dd>
+ <dt id="insertRule">{{domxref("CSSStyleSheet.insertRule()")}}</dt>
+ <dd>Inserts a new rule at the specified position in the style sheet, given the textual representation of the rule.</dd>
+</dl>
+
+<h2 id="Notes">Notes</h2>
+
+<p>In some browsers, if a stylesheet is loaded from a different domain, calling <code>cssRules</code> results in <code>SecurityError</code>.</p>
+
+<p>A stylesheet is associated with at most one {{domxref("Document")}}, which it applies to (unless {{domxref("StyleSheet.disabled", "disabled", "", 1)}}). A list of <code>CSSStyleSheet</code> objects for a given document can be obtained using the {{domxref("document.styleSheets")}} property. A specific style sheet can also be accessed from its <em>owner</em> object (<code>Node</code> or <code>CSSImportRule</code>), if any.</p>
+
+<p>A <code>CSSStyleSheet</code> object is created and inserted into the document's <code>styleSheets</code> list automatically by the browser, when a style sheet is loaded for a document. As the {{domxref("document.styleSheets")}} list cannot be modified directly, there's no useful way to create a new <code>CSSStyleSheet</code> object manually (although <a href="https://wicg.github.io/construct-stylesheets/">Constructable Stylesheet Objects</a> is coming to the web platform soon and is already supported in Blink). To create a new stylesheet, insert a {{HTMLElement("style")}} or {{HTMLElement("link")}} element into the document.</p>
+
+<p>A (possibly incomplete) list of ways a style sheet can be associated with a document follows:</p>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Reason for the style sheet to be associated with the document</th>
+ <th scope="col">Appears in <code>document.<br>
+ styleSheets</code> list</th>
+ <th scope="col">Getting the owner element/rule given the style sheet object</th>
+ <th scope="col">The interface for the owner object</th>
+ <th scope="col">Getting the CSSStyleSheet object from the owner</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{HTMLElement("style")}} and {{HTMLElement("link")}} elements in the document</td>
+ <td>Yes</td>
+ <td>{{domxref("StyleSheet.ownerNode", ".ownerNode")}}</td>
+ <td>{{domxref("HTMLLinkElement")}},<br>
+ {{domxref("HTMLStyleElement")}},<br>
+ or {{domxref("SVGStyleElement")}}</td>
+ <td>{{domxref("LinkStyle.sheet", ".sheet")}}</td>
+ </tr>
+ <tr>
+ <td>CSS {{cssxref("@import")}} rule in other style sheets applied to the document</td>
+ <td>Yes</td>
+ <td>{{domxref("CSSStyleSheet.ownerRule", ".ownerRule")}}</td>
+ <td>{{domxref("CSSImportRule")}}</td>
+ <td>{{domxref("CSSImportRule.styleSheet", ".styleSheet")}}</td>
+ </tr>
+ <tr>
+ <td><code>&lt;?xml-stylesheet ?&gt;</code> processing instruction in the (non-HTML) document</td>
+ <td>Yes</td>
+ <td>{{domxref("StyleSheet.ownerNode", ".ownerNode")}}</td>
+ <td>{{domxref("ProcessingInstruction")}}</td>
+ <td>{{domxref("LinkStyle.sheet", ".sheet")}}</td>
+ </tr>
+ <tr>
+ <td>HTTP Link Header</td>
+ <td>Yes</td>
+ <td><em>N/A</em></td>
+ <td>N/A</td>
+ <td>N/A</td>
+ </tr>
+ <tr>
+ <td>User agent (default) style sheets</td>
+ <td>No</td>
+ <td>N/A</td>
+ <td>N/A</td>
+ <td>N/A</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th>Specification</th>
+ <th>Status</th>
+ <th>Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName("CSSOM", "#cssstylesheet", 'CSSStyleSheet')}}</td>
+ <td>{{Spec2("CSSOM")}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName("DOM2 Style", "css.html#CSS-CSSStyleSheet", "CSSStyleSheet")}}</td>
+ <td>{{Spec2("DOM2 Style")}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("api.CSSStyleSheet")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/CSS_Object_Model/Using_dynamic_styling_information">Using dynamic styling information</a></li>
+</ul>