aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/_colon_read-only/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/css/_colon_read-only/index.html')
-rw-r--r--files/zh-cn/web/css/_colon_read-only/index.html96
1 files changed, 96 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/_colon_read-only/index.html b/files/zh-cn/web/css/_colon_read-only/index.html
new file mode 100644
index 0000000000..02f90acee8
--- /dev/null
+++ b/files/zh-cn/web/css/_colon_read-only/index.html
@@ -0,0 +1,96 @@
+---
+title: ':read-only'
+slug: 'Web/CSS/:read-only'
+tags:
+ - CSS
+ - readOnly
+translation_of: 'Web/CSS/:read-only'
+---
+<div>{{CSSRef}}</div>
+
+<p> <strong><code>:read-only</code></strong> <a href="/en-US/docs/Web/CSS">CSS</a> <a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">伪类</a> 表示元素不可被用户编辑的状态(如锁定的文本输入框)。</p>
+
+<pre class="brush: css no-line-numbers">/* Selects any &lt;input&gt; element that is read-only */
+/* Supported in Firefox with a prefix */
+input:-moz-read-only {
+ background-color: #ccc;
+}
+
+/* Supported in Blink/WebKit/Edge without a prefix */
+input:read-only {
+ background-color: #ccc;
+}</pre>
+
+<div class="note">
+<p>注意:这个选择器不只是选择具有 {{htmlattrxref("readonly", "input")}} 属性的{{htmlElement("input")}} 元素,它也会选择所有的不能被用户编辑的元素。</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">{{csssyntax}}</pre>
+
+<h2 id="Example" name="Example">示例</h2>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html">&lt;input type="text" value="Type whatever you want here."&gt;
+&lt;input type="text" value="This is a read-only field." readonly&gt;
+&lt;p&gt;This is a normal paragraph.&lt;/p&gt;
+&lt;p contenteditable="true"&gt;You can edit this paragraph!&lt;/p&gt;</pre>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css">input { min-width: 25em; }
+input:-moz-read-only { background: cyan; }
+input:read-only { background: cyan; }
+
+p:-moz-read-only { background: lightgray; }
+p:read-only { background: lightgray; }
+p[contenteditable="true"] { color: blue; }
+</pre>
+
+<h3 id="输出">输出</h3>
+
+<p>{{EmbedLiveSample("Example")}}</p>
+
+<h2 class="editable" id="Specifications" name="Specifications">规范</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('HTML WHATWG', '#selector-read-only', ':read-only') }}</td>
+ <td>{{ Spec2('HTML WHATWG') }}</td>
+ <td>No change.</td>
+ </tr>
+ <tr>
+ <td>{{ SpecName('HTML5 W3C', '#selector-read-only', ':read-only') }}</td>
+ <td>{{ Spec2('HTML5 W3C') }}</td>
+ <td>Defines the semantics regarding HTML and constraint validation.</td>
+ </tr>
+ <tr>
+ <td>{{ SpecName('CSS4 Selectors', '#rw-pseudos', ':read-only') }}</td>
+ <td>{{ Spec2('CSS4 Selectors') }}</td>
+ <td>Defines the pseudo-class, but not the associated semantics.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("css.selectors.read-only")}}</p>
+
+<h2 id="See_also" name="See_also">参阅</h2>
+
+<ul>
+ <li>{{cssxref(":read-write")}}</li>
+ <li>HTML {{htmlattrxref("contenteditable")}} attribute</li>
+</ul>