aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/_colon_read-write
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/css/_colon_read-write
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/css/_colon_read-write')
-rw-r--r--files/zh-cn/web/css/_colon_read-write/index.html93
1 files changed, 93 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/_colon_read-write/index.html b/files/zh-cn/web/css/_colon_read-write/index.html
new file mode 100644
index 0000000000..23735a5573
--- /dev/null
+++ b/files/zh-cn/web/css/_colon_read-write/index.html
@@ -0,0 +1,93 @@
+---
+title: ':read-write'
+slug: 'Web/CSS/:read-write'
+translation_of: 'Web/CSS/:read-write'
+---
+<div>{{CSSRef}}</div>
+
+<p><strong><code>:read-write</code></strong> <code><a href="/en-US/docs/Web/CSS">CSS</a></code> <code><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes">伪类</a></code> 代表一个元素(例如可输入文本的 input元素)可以被用户编辑。</p>
+
+<pre class="brush: css no-line-numbers">/* 选择所有可编辑的 &lt;input&gt; 元素 */
+/* Firefox 中需要加前缀 */
+input:-moz-read-write {
+ background-color: #bbf;
+}
+
+/* Supported in Blink/WebKit/Edge without a prefix */
+input:read-write {
+ background-color: #bbf;
+}</pre>
+
+<div class="note">
+<p><strong>注意:</strong>这个选择器不仅仅选择 {{htmlElement("input")}} 元素,它也会选择所有可以被用户编辑的元素,例如设置了 {{htmlattrxref("contenteditable")}} 属性的  {{htmlelement("p")}} 元素。</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 line-numbers language-css">input { min-width: 25em; }
+input:-moz-read-write { background: cyan; }
+input:read-write { background: cyan; }
+
+p:-moz-read-write { background: lightgray; }
+p:read-write { 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-write', ':read-write') }}</td>
+ <td>{{ Spec2('HTML WHATWG') }}</td>
+ <td>No change.</td>
+ </tr>
+ <tr>
+ <td>{{ SpecName('HTML5 W3C', '#selector-read-write', ':read-write') }}</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-write') }}</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-write")}}</p>
+
+<h2 id="See_also" name="See_also">参阅</h2>
+
+<ul>
+ <li>{{cssxref(":read-only")}}</li>
+ <li>HTML {{htmlattrxref("contenteditable")}} attribute</li>
+</ul>