-
Notifications
You must be signed in to change notification settings - Fork 8k
/
index.md
100 lines (69 loc) · 1.93 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---
title: ":indeterminate"
slug: Web/CSS/:indeterminate
---
{{CSSRef}}
La [pseudo-clase](/es/docs/Web/CSS/Pseudo-classes) **`:indeterminate`** de [CSS](/es/docs/Web/CSS) representa cualquier elemento de formulario cuyo estado sea indeterminado.
```css
/* Selecciona cualquier <input> cuyo estado sea indeterminado */
input:indeterminate {
background: lime;
}
```
Los elementos seleccionados por este selector son:
- Elementos [`<input type="checkbox">`](/es/docs/Web/HTML/Element/input/checkbox) cuya propiedad `indeterminate` se establece en `true` por [JavaScript](/es/docs/Web/JavaScript)
- Elementos [`<input type="radio">`](/es/docs/Web/HTML/Element/input/radio), cuando todos los radio buttons con el mismo valor `name` en el formulario no están marcados
- Elementos {{HTMLElement("progress")}} en un estado indeterminado
## Sintaxis
{{csssyntax}}
## Ejemplos
### Checkbox y radio button
Este ejemplo aplica estilos especiales a las etiquetas asociadas con campos de formulario indeterminados.
#### HTML
```html
<div>
<input type="checkbox" id="checkbox" />
<label for="checkbox">Esta etiqueta comienza con el color lima.</label>
</div>
<div>
<input type="radio" id="radio" />
<label for="radio">Esta etiqueta comienza con el color lima.</label>
</div>
```
#### CSS
```css
input:indeterminate + label {
background: lime;
}
```
#### JavaScript
```js
var inputs = document.getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
inputs[i].indeterminate = true;
}
```
#### Resultado
{{EmbedLiveSample('Checkbox_y_radio_button', 'auto', 50)}}
### Barra de progreso
#### HTML
```html
<progress></progress>
```
#### CSS
```css
progress {
margin: 4px;
}
progress:indeterminate {
opacity: 0.5;
background-color: lightgray;
box-shadow: 0 0 2px 1px red;
}
```
#### Resultado
{{EmbedLiveSample('Barra_de_progreso', 'auto', 30)}}
## Especificaciones
{{Specifications}}
## Compatibilidad con navegadores
{{Compat}}