1
HTML/CSSBeginner#html#forms
Attributes like required, pattern, min, max, minlength, maxlength, and type trigger built-in browser validation without JavaScript. The :invalid and :valid CSS pseudo-classes can style fields based on validity, and the Constraint Validation API (checkValidity()) allows custom JS hooks.
<form>
<input type="text" pattern="[A-Za-z]{3,}" required title="At least 3 letters">
<input type="email" required>
<button type="submit">Submit</button>
</form>