MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

:placeholder-shown

This translation is incomplete. Please help translate this article from English.

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

Sumari

The :placeholder-shown pseudo-classe representa qualsevol element de formulari que mostra text de marcador de posició (placeholder text).

Sintaxi

:placeholder-shown { style properties }

Exemple

HTML

<input placeholder="Type something here">

CSS

input {
  border: 2px solid black;
  padding: 3px;
}

:placeholder-shown {
  border-color: silver;
}

Resultat

Especificacions

Especificació Estat Comentari
Selectors Level 4
The definition of ':placeholder' in that specification.
Working Draft Definició inicial.

Característica Chrome Firefox (Gecko) Internet Explorer Edge Opera Safari
Suport bàsic
(en <input type="text">)
47.0 51.0 (51.0)[1] No support No support[2] 34.0 9.0
en type="number", type="time", i similars ? No support No support No support ? ?
Característica Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Suport bàsic
(en <input type="text">)
51.0 51.0 (51.0)[1] No support No support 9.2
en type="number", type="time", i similars ? No support No support No support ?

[1] Abans de Gecko 51.0 (Firefox 51.0 / Thunderbird 51.0 / SeaMonkey 2.48) Gecko va implementar una pseudo-classe prefix -moz anomenada :-moz-placeholder, que més tard va ser substituït per un pseudo-element ::-moz-placeholder. La pseudo-classe estàndard es va aconseguir implementar en errada 1069012.

[2] Se sol·licita suport a aquesta pseudo-classe en la pàgina de Microsoft Edge Developer Feedback.

Veure

Document Tags and Contributors

 Contributors to this page: Legioinvicta
 Last updated by: Legioinvicta,