HTML5 Forms and Pseudo-Classes


design in deep

Pseudo-Classes
A pseudo-class is information about an element that’s in the document tree but not available through any specified attributes. For example, the :first-child pseudo-class applies to elements which are the first child of their parents. You can get that information from the DOM tree, but there’s no first-child attribute.

In CSS2.1, there were a handful of pseudo-classes available, notably the link states (:link:visited) and those of user actions (:active,:hover). In CSS3, that handful becomes a basketful, with pseudo-classes of structure (:nth-child:nth-of-type), UI element (:enabled:checked), and the ones we’ll look at now, of form validation.

Form Validation without JavaScript

So as I mentioned at the beginning, HTML5 introduces client-side form validation without the need for JavaScript. When you attempt to submit a form, your browser will validate all of the fields and return an error if any of…

View original post 1,048 more words