CSS styling guide

Created by Alison Gianotto, Modified on Fri, 5 Feb, 2021 at 3:55 PM by Alison Gianotto

You can use standard CSS validation classes to control the display of valid and invalid form elements - such as:


/* Selects any valid <input> */
input:valid {
  background-color: powderblue;
}

/* Selects any invalid <input> */
input:invalid {
  background-color: pink;
}


(From the excellent documentation at https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation)

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article