blob: 1baa216663bc883d3cd7a5a384f56e40c2ad9dad (
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
|
---
title: ':-ms-input-placeholder'
slug: 'Web/CSS/:-ms-input-placeholder'
tags:
- CSS
- Non-standard
- Pseudo-classe
- Référence(2)
translation_of: 'Web/CSS/:placeholder-shown'
---
<div>{{Non-standard_header}}{{CSSRef}}</div>
<p>La pseudo-classe <strong><code>:-ms-input-placeholder</code></strong> représente le texte de substitution d'un élément de formulaire. Elle permet aux auteurs et aux développeurs web d'adapter l'apparence des textes de substitution. Cette pseudo-classe est propriétaire et est uniquement prise en charge par Internet Explorer et Edge.</p>
<h2 id="Exemples">Exemples</h2>
<p>Dans l'exemple suivant, le champ « Identifiant » a un style particulier. Le texte de substitution est affiché de cette façon jusqu'à ce que le focus passe sur le champ (ce qui correspond à une saisie).</p>
<h3 id="CSS">CSS</h3>
<pre class="brush: css">input {
background-color:#E8E8E8;
color:black;
}
/* Style pour le texte de substitution */
input.studentid:-ms-input-placeholder {
font-style:italic;
color: red;
background-color: yellow;
}</pre>
<h3 id="HTML">HTML</h3>
<pre class="brush: html"><form id="test">
<p><label>Saisir le nom : <input id="nom" placeholder="Nom de l'étudiant"/></label></p>
<p><label>Saisir le domaine : <input id="domaine" placeholder="Domaine d'étude" /></label></p>
<p><label>Saisir l'identifiant : <input type="num" pattern="[0-9]{8}" title="8 digit ID" id="sid" class="studentid" placeholder="Identifiant à 8 chiffres" /></label></p>
<input type="submit" />
</form></pre>
<h3 id="Résultat">Résultat</h3>
<p>{{EmbedLiveSample("Exemples","300","300")}}</p>
<h3 id="Capture_d'écran">Capture d'écran</h3>
<p><img alt="" src="https://mdn.mozillademos.org/files/12684/bandicam%202016-03-08%2001-48-59-851.jpg" style="border-style: solid; border-width: 1px; height: 160px; margin: 0px; width: 650px;"></p>
<h2 id="Spécifications">Spécifications</h2>
<p>Cette pseudo-classe est une pseudo-classe propriétaire liée à Trident/Microsoft et ne fait partie d'aucune spécification. <a href="https://msdn.microsoft.com/en-us/library/hh772745(v=vs.85).aspx">MSDN documente cette pseudo-classe</a>.</p>
<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Fonctionnalité</th>
<th>Chrome</th>
<th>Firefox (Gecko)</th>
<th>Edge</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari (WebKit)</th>
</tr>
<tr>
<td>Support simple</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
<td>10</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Fonctionnalité</th>
<th>Android</th>
<th>Firefox Mobile (Gecko)</th>
<th>Firefox OS</th>
<th>IE Phone</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Support simple</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
</tr>
</tbody>
</table>
</div>
<h2 id="Voir_aussi">Voir aussi</h2>
<ul>
<li>{{cssxref("::placeholder")}}</li>
<li>{{cssxref("::-webkit-input-placeholder")}}</li>
<li>{{cssxref("::-moz-placeholder")}}</li>
<li><a href="/fr/docs/Web/Guide/HTML/Forms_in_HTML">Les formulaires en HTML</a></li>
<li>{{HTMLElement("input")}}</li>
<li>{{HTMLElement("textarea")}}</li>
</ul>
|