HTML and CSS Reference
Ta k i n g t h e e x a m p l e of f a t i m e c of n t r of l , y of u c a n a l s of u s e step=any .
This allows any time in the day to be selected, with any accu-
racy (for example, thousandth-of-a-second accuracy or more);
normally, time controls are limited to an accuracy of one minute.
<input name=favtime type=time step=any>
It's pretty confusing to work out which attributes go with which
input types when you're meeting them all at once as we are
here. But it's actually quite straightforward when you start using
them. For example, you can't use min and max on a <textarea> ,
because that wouldn't make sense, but you can use required .
A blog comments form
Let's look at a classic form example that most of us will already
be familiar with. Nearly all blogs have a comment section, with
fi e fi d s fi o r c o m m e n t e r ' s n a m e ( r e q u fi r e d ) , h e r e m a fi fi a d d r e s s
(required), URL (optional), and the comment (required). That
validation by hand.
In HTML5, however, it requires only some new form types, each
with a name attribute that the spec requires in order to participate
in automatic validation. We also add a submit button—currently
Opera only validates fields when a form is actually submitted,
although the :invalid pseudo-class is applied as the user types.
<input name=form-name id=form-name type=text required>
<input name=form-email id=form-email type=email required>
<input name=form-url id=form-url type=url>
<textarea name=form-comment id=form-comment required>