Form validation feedback using CSS :user-valid / :user-invalid pseudo-classes and the adjacent-sibling combinator (~). Works like Tailwind's peer syntax. Type into the inputs below to trigger validation.
.validate to an <input> or a wrapper <div> containing an input..validate-* message container as a sibling after the validate element.validate-invalid, validate-required, validate-out-of-range, validate-user-invalid.--i18n-valid, --i18n-invalid, --i18n-required, --i18n-outofrange, --i18n-wrongemail, --i18n-wrongurl, --i18n-wrongformat.When .validate-* container has text content, it overrides the default i18n message.
Please enter exactly 3 digits
Custom email error message
Name is required
Override these CSS variables in :root to customize all validation messages globally:
--i18n-valid: "Validation passed";
--i18n-invalid: "Validation failed";
--i18n-required: "This field is required";
--i18n-outofrange: "Value is out of range";
--i18n-wrongemail: "Please enter a valid email";
--i18n-wrongurl: "Please enter a valid URL";
--i18n-wrongformat: "Invalid format";