HTML and CSS Reference
In-Depth Information
Email and URLs
Now that you've seen the validation
features, let's consider two further
new input types:
email
and
url
. We
didn't look at them until now
because, without
HTML5
's validation features, they look and behave
identical to
HTML4
text inputs.
On the web, there are
probably more forms
where you need to
enter an email
address than forms
where you don't.
Email addresses
Having seen the
pattern
attribute, you're probably
thinking it would be straightforward to either
write your own regular expression or find one on
the web and then implement your own email field.
The problem is, you'd probably get it wrong. Email
had reached the popular consciousness even before
the web was born, and despite some confusion,
most people can recognize an email address. Let's
have one of our resident experts do a quick test to
see if you really know what an email address looks
like.
email
url
5
4
4
4
10
10
9
9
5
4
Pitr's email validity test
for aspiring evil geniuses
We will
be seeink if you
half as smart as
you thinkink
you are
Valid?
1. rob+crowther@domain.com
2. rob!crowther@domain.com
3. rob@crowther@domain.com
4. rob,crowther@domain.com
5. rob
-
crowther@domain.com
6. rob_crowther@domain.com
7. rob crowther@domain.com
8. "robcrowther'@domain.com
9. 'rob crowther'@domain.com
10. 'robcrowther'@domain.com