aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/_colon_enabled/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/zh-cn/web/css/_colon_enabled/index.html
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_enabled/index.html')
-rw-r--r--files/zh-cn/web/css/_colon_enabled/index.html101
1 files changed, 101 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/_colon_enabled/index.html b/files/zh-cn/web/css/_colon_enabled/index.html
new file mode 100644
index 0000000000..ac57afafaf
--- /dev/null
+++ b/files/zh-cn/web/css/_colon_enabled/index.html
@@ -0,0 +1,101 @@
+---
+title: ':enabled'
+slug: 'Web/CSS/:enabled'
+tags:
+ - CSS
+ - Reference
+ - Web
+ - 伪类
+ - 参考
+ - 布局
+translation_of: 'Web/CSS/:enabled'
+---
+<div>{{CSSRef}}</div>
+
+<p><a href="/zh-CN/docs/Web/CSS">CSS</a> <a href="/zh-CN/CSS/Pseudo-classes">伪类</a> <strong><code>:enabled</code></strong> 表示任何被启用的(enabled)元素。如果一个元素能够被激活(如选择、点击或接受文本输入),或者能够获取焦点,则该元素是启用的。元素也有一个禁用的状态(disabled state),在被禁用时,元素不能被激活或获取焦点。</p>
+
+<pre class="brush: css no-line-numbers">/* 选择任何启用状态的 &lt;input&gt; */
+input:enabled {
+ color: blue;
+}</pre>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">{{csssyntax}}</pre>
+
+<h2 id="示例">示例</h2>
+
+<p>下面的代码,当文本输入框处于启用状态时,输入框 {{htmlElement("input")}} 的文本是绿色的,处于禁用状态时,输入框的文本则是灰色的。这样可以把元素是否可用反馈给用户。</p>
+
+<p>HTML:</p>
+
+<pre class="brush:html">&lt;form action="url_of_form"&gt;
+ &lt;label for="FirstField"&gt;First field (enabled):&lt;/label&gt;
+ &lt;input type="text" id="FirstField" value="Lorem"&gt;&lt;br&gt;
+
+ &lt;label for="SecondField"&gt;Second field (disabled):&lt;/label&gt;
+ &lt;input type="text" id="SecondField" value="Ipsum" disabled="disabled"&gt;&lt;br&gt;
+
+ &lt;input type="button" value="Submit"&gt;
+&lt;/form&gt;</pre>
+
+<p>CSS:</p>
+
+<pre class="brush:css;">input:enabled {
+ color: #2b2;
+}
+
+input:disabled {
+ color: #aaa;
+}
+</pre>
+
+<h3 id="结果">结果</h3>
+
+<div>{{EmbedLiveSample("Enabled_Disabled_Inputs_Example",550,95)}}</div>
+
+<h2 id="规范">规范</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-enabled', ':enabled')}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td>No change.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML5 W3C', '#selector-enabled', ':enabled')}}</td>
+ <td>{{Spec2('HTML5 W3C')}}</td>
+ <td>Defines the semantics for HTML and forms.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS4 Selectors', '#enableddisabled', ':enabled')}}</td>
+ <td>{{Spec2('CSS4 Selectors')}}</td>
+ <td>No change.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS3 Selectors', '#enableddisabled', ':enabled')}}</td>
+ <td>{{Spec2('CSS3 Selectors')}}</td>
+ <td>Defines the pseudo-class, but not the associated semantics.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("css.selectors.enabled")}}</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li>{{ Cssxref(":disabled") }}</li>
+</ul>