pseudo-class
:valid — CSS reference
Matches controls meeting their applicable constraints; optional empty values can be valid. It does not imply server-side validation.
Formal Syntax & Structure
css syntaxcss
:validWorking Example
Example Snippetcss
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Selector lab</title><style>:where(.sample) { color: rgb(32, 32, 32); }input:valid { color: rgb(0, 96, 80); }</style></head><body><label>A <input id="a" class="sample" type="email" value="a@example.test"></label><label>B <input id="b" class="sample" type="email" value="bad"></label></body></html>