HTML and CSS Reference
Figure 1.2. You can use the new placeholder attribute to provide a piece of text that should be displayed in a
field when it's empty. This text is typically gray and will be removed when you populate the field with a value.
Table 1.2 provides a list of the new input attributes introduced in HTML5. You'll look at
which attributes apply to which input types in chapter 2 .
New attributes for performing client-side validation
Some of these attributes allow the browser to perform client-side validation without
or the browser will produce an error. The pattern attribute allows you to define a regular
expression that the input value will be tested against. The max and min attributes allow
you to restrict the maximum and minimum values on number and date field types.
In addition, the browser will perform validation on some of the new input types to warn
users when they have entered values in an incorrect format. If the user enters an invalid
email address in an email input field, for example, the browser will flag an error and pre-
vent the form from being submitted to the server.
You should never rely solely on client-side validation, whether it's the new native browser
tion, so you should always check input on the server side. Client-side validation should be
used to improve the user experience, not as application security.
show you other new elements introduced in HTML5 that you can easily, and immediately,
integrate into your applications.