aboutsummaryrefslogtreecommitdiff
path: root/files/de/web/css/_colon_in-range/index.html
blob: fab2145bcf4420aaf221c1332b42d1c219fc9ac6 (plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
title: ':in-range'
slug: 'Web/CSS/:in-range'
tags:
  - CSS
  - CSS Pseudoklasse
  - Layout
  - Referenz
  - Web
translation_of: 'Web/CSS/:in-range'
---
<div>{{CSSRef}}</div>

<p>Die <strong><code>:in-range</code></strong> <a href="/en-US/docs/Web/CSS">CSS</a> <a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">Pseudoklasse</a> entspricht einem {{htmlelement("input")}} Element, dessen aktueller Wert innerhalb eines bestimmten Bereichs liegt. Dieser Bereich wird durch die {{htmlattrxref("min", "input")}} und {{htmlattrxref("max","input")}} Attribute festgelegt.</p>

<pre class="brush: css no-line-numbers">/* Wählt jedes &lt;input&gt; Element aus, aber nur wenn es eine
   Begrenzung festlegt, und sein Wert innerhalb dieser
   Begrenzung liegt */
input:in-range {
  background-color: rgba(0, 255, 0, 0.25);
}</pre>

<p>Diese Pseudoklasse ist nützlich um den Nutzer visuell darauf hinzuweisen, dass der aktuelle Wert des Feldes innerhalb der erlaubten Begrenzungen liegt.</p>

<div class="note"><strong>Note: </strong>Diese Pseudoklasse gilt nur für Elemente, die eine Begrenzung haben. Wenn es eine solche Begrenzung nicht gibt, kann der Wert des Elements weder "in-range" (innerhalb der Begrenzung) noch "out-of-range" (außerhalb der Begrenzung) sein.</div>

<h2 id="Syntax">Syntax</h2>

{{csssyntax}}

<h2 id="Example" name="Example">Beispiel</h2>

<div id="example">
<h3 id="HTML">HTML</h3>

<pre class="brush: html">&lt;form action="" id="form1"&gt;
  &lt;ul&gt;Werte zwischen 1 und 10 sind gültig.
    &lt;li&gt;
      &lt;input id="value1" name="value1" type="number" placeholder="1 to 10" min="1" max="10" value="12"&gt;
      &lt;label for="value1"&gt;Der Wert ist &lt;/label&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
&lt;/form&gt;</pre>

<h3 id="CSS">CSS</h3>

<pre class="brush: css;">li {
  list-style: none;
  margin-bottom: 1em;
}

input {
  border: 1px solid black;
}

input:in-range {
  background-color: rgba(0, 255, 0, 0.25);
}

input:out-of-range {
  background-color: rgba(255, 0, 0, 0.25);
  border: 2px solid red;
}

input:in-range + label::after {
  content: 'okay.';
}

input:out-of-range + label::after {
  content: 'außerhalb der Begrenzung!';
}</pre>

<h3 id="Result">Result</h3>
</div>

<div>{{EmbedLiveSample('Example', 600, 140)}}</div>

<h2 id="Spezifikationen">Spezifikationen</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'scripting.html#selector-in-range', ':in-range')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>Definiert wann <code>:in-range</code> HTML-Elementen entspricht.</td>
  </tr>
  <tr>
   <td>{{SpecName('CSS4 Selectors', '#in-range-pseudo', ':in-range')}}</td>
   <td>{{Spec2('CSS4 Selectors')}}</td>
   <td>Standard Wert definiert.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<div>
<div>
<div class="hidden">Die Kompatibilitätstabelle auf dieser Seite wurde aus strukturierten Daten generiert. Wenn du dazu beitragen möchtes gehe auf <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> und sende uns einen Pull Request.</div>

<p>{{Compat("css.selectors.in-range")}}</p>
</div>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{cssxref(":out-of-range")}}</li>
 <li><a href="/en-US/docs/Learn/HTML/Forms/Form_validation">Form data validation</a></li>
</ul>