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

The pseudo-class CSS :valid representa qualsevol element <input> o altre <form> el contingut del qual es valida correctament. Això permet fer, fàcilment, que els camps vàlids adoptin una aparença que ajudi a l'usuari a confirmar que les seves dades estan formatades correctament.

/* Selecciona qualsevol <input> vàlid */
input:valid {
  background-color: powderblue;
}

Aquesta pseudo-class és útil per ressaltar els camps correctes per a l'usuari.

Sintaxi

:valid

Exemples

Vegeu :invalid com exemple.

Especificacions

Especificació Estat Comentari
HTML Living Standard
The definition of ':valid' in that specification.
Living Standard Cap canvi.
HTML5
The definition of ':valid' in that specification.
Recommendation Defineix la semàntica respecte a l'HTML i la validació de restriccions.
Selectors Level 4
The definition of ':valid' in that specification.
Working Draft Definició inicial.

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 10Edge Full support 12Firefox Full support 4IE Full support 10Opera Full support 10Safari Full support 5WebView Android ? Chrome Android ? Edge Mobile Full support YesFirefox Android Full support 4Opera Android Full support 10Safari iOS Full support 5Samsung Internet Android ?
Applies to <form> elementsChrome Full support YesEdge No support NoFirefox Full support 13IE No support NoOpera Full support YesSafari ? WebView Android ? Chrome Android ? Edge Mobile No support NoFirefox Android Full support 14Opera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

Vegeu també

Document Tags and Contributors

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