aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/stylesheet
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/zh-cn/web/api/stylesheet
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/stylesheet')
-rw-r--r--files/zh-cn/web/api/stylesheet/disabled/index.html57
-rw-r--r--files/zh-cn/web/api/stylesheet/href/index.html53
-rw-r--r--files/zh-cn/web/api/stylesheet/index.html55
-rw-r--r--files/zh-cn/web/api/stylesheet/media/index.html35
-rw-r--r--files/zh-cn/web/api/stylesheet/title/index.html32
5 files changed, 232 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/stylesheet/disabled/index.html b/files/zh-cn/web/api/stylesheet/disabled/index.html
new file mode 100644
index 0000000000..a18d5f068f
--- /dev/null
+++ b/files/zh-cn/web/api/stylesheet/disabled/index.html
@@ -0,0 +1,57 @@
+---
+title: StyleSheet.disabled
+slug: Web/API/StyleSheet/disabled
+tags:
+ - API
+ - CSSOM
+ - Disabled
+ - Property
+ - Reference
+translation_of: Web/API/StyleSheet/disabled
+---
+<div>{{APIRef("CSSOM")}}</div>
+
+<div>{{domxref("StyleSheet")}}接口的 <strong><code>disabled</code> </strong>属性用于决定样式表是否被禁用于文档。</div>
+
+<div>样式表被禁用可能由于这个属性被手动设置为 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">true</span></font>,也可能是因为样式表是未激活的<a href="https://wiki.developer.mozilla.org/en-US/docs/Web/CSS/Alternative_style_sheets">alternative style sheet</a>。注意 <code>disabled == false</code> 并不保证样式表一定生效(例如它可能被移除出文档)。</div>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="syntaxbox"><em>bool</em> = stylesheet.disabled
+</pre>
+
+<h2 id="Example" name="Example">例子</h2>
+
+<pre>// 如果样式表被禁用
+if (stylesheet.disabled) {
+ // 添加行内样式
+}
+</pre>
+
+<h2 id="Specification" name="Specification">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">注释</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName("CSSOM", "#dom-stylesheet-disabled", "StyleSheet.disabled")}}</td>
+ <td>{{Spec2("CSSOM")}}</td>
+ <td>No change from {{SpecName("DOM2 Style")}}.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName("DOM2 Style", "stylesheets.html#StyleSheets-StyleSheet-disabled", "StyleSheet.disabled")}}</td>
+ <td>{{Spec2("DOM2 Style")}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{Compat("api.StyleSheet.disabled")}}</p>
diff --git a/files/zh-cn/web/api/stylesheet/href/index.html b/files/zh-cn/web/api/stylesheet/href/index.html
new file mode 100644
index 0000000000..d023340f78
--- /dev/null
+++ b/files/zh-cn/web/api/stylesheet/href/index.html
@@ -0,0 +1,53 @@
+---
+title: href
+slug: Web/API/StyleSheet/href
+translation_of: Web/API/StyleSheet/href
+---
+<div>{{APIRef("CSSOM")}}</div>
+
+<h3 id="Summary" name="Summary">概述</h3>
+
+<p>返回当前样式表文件的URI地址.</p>
+
+<h3 id="Syntax" name="Syntax">语法</h3>
+
+<pre class="eval"><em>uri</em> = stylesheet.href
+</pre>
+
+<h3 id="Parameters" name="Parameters">参数</h3>
+
+<ul>
+ <li><code>uri</code> 为一个字符串,包含了样式表文件的URI地址.</li>
+</ul>
+
+<h3 id="Example" name="Example">例子</h3>
+
+<pre> // 在本机环境下
+ &lt;html&gt;
+ &lt;head&gt;
+ &lt;link rel="StyleSheet" href="example.css" type="text/css" /&gt;
+ &lt;script&gt;
+ function sref() {
+ alert(document.styleSheets[0].href);
+ }
+ &lt;/script&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;div class="thunder"&gt;Thunder&lt;/div&gt;
+ &lt;button onclick="sref()"&gt;ss&lt;/button&gt;
+ &lt;/body&gt;
+ &lt;/html&gt;
+// 弹出 "file:////C:/Windows/Desktop/example.css
+</pre>
+
+<h3 id="Notes" name="Notes">备注</h3>
+
+<p>如果该样式表是一个外链样式表文件,则它的href属性值为样式表文件的URI. 但如果该样式表是一个内联样式表,则它的href属性值为<code>null</code>.</p>
+
+<p>该属性在Firefox, Opera, Google Chrome, Safari中为只读属性,在Internet Explorer中可读可写.</p>
+
+<h3 id="Specification" name="Specification">规范</h3>
+
+<p><a class="external" href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/stylesheets.html#StyleSheets-StyleSheet-href">stylesheet.href </a></p>
+
+<p>{{ languages( {"en": "en/DOM/StyleSheet/href" } ) }}</p>
diff --git a/files/zh-cn/web/api/stylesheet/index.html b/files/zh-cn/web/api/stylesheet/index.html
new file mode 100644
index 0000000000..6b3011bc68
--- /dev/null
+++ b/files/zh-cn/web/api/stylesheet/index.html
@@ -0,0 +1,55 @@
+---
+title: StyleSheet
+slug: Web/API/StyleSheet
+translation_of: Web/API/StyleSheet
+---
+<div>{{APIRef("CSSOM")}}</div>
+
+<p> 表示一个实现<code>StyleSheet</code>接口的对象样式表。 CSS样式表将进一步实现更专业的 {{domxref("CSSStyleSheet")}} 接口。</p>
+
+<h2 id="Properties" name="Properties">属性</h2>
+
+<dl>
+ <dt>{{domxref("StyleSheet.disabled")}}</dt>
+ <dd>返回{{domxref("Boolean")}}表示当前样式表是否可用.</dd>
+ <dt>{{domxref("StyleSheet.href")}} {{readonlyInline}}</dt>
+ <dd>返回 {{domxref("DOMString")}} 表示样式表的位置.</dd>
+ <dt>{{domxref("StyleSheet.media")}} {{readonlyInline}}</dt>
+ <dd>返回 {{domxref("MediaList")}} 表示样式的预期目标媒体</dd>
+ <dt>{{domxref("StyleSheet.ownerNode")}} {{readonlyInline}}</dt>
+ <dd>返回 {{domxref("Node")}} 将此样式表与当前文档相关联。</dd>
+ <dt>{{domxref("StyleSheet.parentStyleSheet")}} {{readonlyInline}}</dt>
+ <dd>返回 {{domxref("StyleSheet")}} 如果有的话; 返回 <code>null</code> 如果没有.</dd>
+ <dt>{{domxref("StyleSheet.title")}} {{readonlyInline}}</dt>
+ <dd>返回 {{domxref("DOMString")}} 表示当前样式表的顾问标题。</dd>
+ <dt>{{domxref("StyleSheet.type")}}{{readonlyInline}}</dt>
+ <dd>返回 {{domxref("DOMString")}} 表示当前样式表的语言</dd>
+</dl>
+
+<h2 id="Specification" name="Specification">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">格式</th>
+ <th scope="col">状态</th>
+ <th scope="col">备注</th>
+ </tr>
+ <tr>
+ <td>{{ SpecName('CSSOM', '#stylesheet', 'StyleSheet') }}</td>
+ <td>{{ Spec2('CSSOM') }}</td>
+ <td>No change from {{ SpecName('DOM2 Style') }}.</td>
+ </tr>
+ <tr>
+ <td>{{ SpecName('DOM2 Style', 'stylesheets.html#StyleSheets-StyleSheet', 'StyleSheet') }}</td>
+ <td>{{ Spec2('DOM2 Style') }}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li>{{domxref("CSSStyleSheet")}}</li>
+</ul>
diff --git a/files/zh-cn/web/api/stylesheet/media/index.html b/files/zh-cn/web/api/stylesheet/media/index.html
new file mode 100644
index 0000000000..c82286e57c
--- /dev/null
+++ b/files/zh-cn/web/api/stylesheet/media/index.html
@@ -0,0 +1,35 @@
+---
+title: StyleSheet.media
+slug: Web/API/StyleSheet/media
+translation_of: Web/API/StyleSheet/media
+---
+<div>{{APIRef("CSSOM")}}</div>
+
+<h2 id="Summary" name="Summary">概述</h2>
+
+<p><strong>media</strong> specifies the intended destination medium for style information.</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="eval"><em>medium</em> = stylesheet.media
+stylesheet.media =<em>medium</em>
+</pre>
+
+<h2 id="Parameters" name="Parameters">参数</h2>
+
+<ul>
+ <li><code>medium</code> is a string describing a single medium or a comma-separated list.</li>
+</ul>
+
+<h2 id="Example" name="Example">示例</h2>
+
+<pre>&lt;link rel="StyleSheet" href="document.css" type="text/css" media="screen" /&gt;
+</pre>
+
+<h2 id="Notes" name="Notes">注意</h2>
+
+<p>The default value for media is "screen."</p>
+
+<h2 id="Specification" name="Specification">Specification</h2>
+
+<p>DOM Level 2 Styles - STYLESHEET</p>
diff --git a/files/zh-cn/web/api/stylesheet/title/index.html b/files/zh-cn/web/api/stylesheet/title/index.html
new file mode 100644
index 0000000000..834dfb3e40
--- /dev/null
+++ b/files/zh-cn/web/api/stylesheet/title/index.html
@@ -0,0 +1,32 @@
+---
+title: StyleSheet.title
+slug: Web/API/StyleSheet/title
+translation_of: Web/API/StyleSheet/title
+---
+<div>
+<div>{{APIRef("CSSOM")}}</div>
+</div>
+
+<h2 id="Summary" name="Summary">概述</h2>
+
+<p>The <strong><code>title</code></strong> property of the {{domxref("StyleSheet")}} interface returns the advisory title of the current style sheet.</p>
+
+<p>The title is often specified in the {{domxref("StyleSheet/OwnerNode", "ownerNode")}}.</p>
+
+<p> </p>
+
+<h2 id="Notes" name="Notes">注意</h2>
+
+<p>The title is often specified in the {{domxref("StyleSheet/OwnerNode", "ownerNode")}}.</p>
+
+<h2 id="Specification" name="Specification">Specification</h2>
+
+<ul>
+ <li><a class="external" href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/stylesheets.html#StyleSheets-StyleSheet-title">title </a></li>
+</ul>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("api.StyleSheet.title")}}</p>