Customizing the Validation Error Style

By default, invalid HTML fields in a form appear with a red border. For example, if you submit an HTML form without entering a value in a required field then the field is displayed with a red border.

You can customize the appearance of form fields in different states of validity by using the following Cascading Style Sheet pseudo classes:

Image :valid—Applies when an input element is valid

Image :invalid—Applies when an input element is invalid

:required—Applies when an input element is required (has the required attribute) ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.