-
Benachrichtigungen
You must be signed in to change notification settings - Fork 22.5k
/
index.md
64 lines (42 loc) · 1.36 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
title: ":enabled"
slug: Web/CSS/:enabled
page-type: css-pseudo-class
browser-compat: css.selectors.enabled
---
{{CSSRef}}
The **`:enabled`** [CSS](/en-US/docs/Web/CSS) [pseudo-class](/en-US/docs/Web/CSS/Pseudo-classes) represents any enabled element. An element is enabled if it can be activated (selected, clicked on, typed into, etc.) or accept focus. The element also has a disabled state, in which it can't be activated or accept focus.
{{EmbedInteractiveExample("pages/tabbed/pseudo-class-enabled.html", "tabbed-standard")}}
## Syntax
```plain
:enabled
```
## Examples
The following example makes the color of text and button {{htmlElement("input")}}s green when enabled, and gray when disabled. This helps the user understand which elements can be interacted with.
### HTML
```html
<form action="url_of_form">
<label for="FirstField">First field (enabled):</label>
<input type="text" id="FirstField" value="Lorem" /><br />
<label for="SecondField">Second field (disabled):</label>
<input type="text" id="SecondField" value="Ipsum" disabled /><br />
<input type="button" value="Submit" />
</form>
```
### CSS
```css
input:enabled {
color: #2b2;
}
input:disabled {
color: #aaa;
}
```
### Result
{{EmbedLiveSample("Examples", 550, 95)}}
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{Cssxref(":disabled")}}