HTMLworkingevergreen

Native form validation

The browser already validates for you.

Constraint attributes, the Constraint Validation API, and :invalid styling give you accessible, no-library form validation that blocks bad submissions before any JavaScript runs.

required + :user-invalid styling

HTML+CSS+JSintro
Press Run to execute

Both fields paint with the neutral #2a2218 border on load — :user-invalid deliberately holds off — so the required name field only turns red (#e0533d) once you focus and leave it empty or hit Save, while a filled field turns green via :user-valid. The optional bio field never reddens because it has no constraint to violate.