HTML and CSS Reference
In-Depth Information
<input>
element: the
list
attribute. The attribute gets the name of a
<datalist>
element to be used as
the source of the input options.
When the input field gets the input focus, then the content of the
<datalist>
element is used to
autocomplete what the user is typing. Figure 2-6 shows the element in action on Internet Explorer.
FIGURE 2-6
The
datalist
element in action.
elements removed from older HTML versions
HTML5 adds some new elements, but also removes a few elements whose presence would only
increase redundancy once combined with the new capabilities of CSS and new elements in HTML5.
The list of elements no longer supported most notably includes
and
font
elements. It should
be noted, though, that the
<iframe>
element remains available.
In addition, a few style elements such as
<center>
,
<u>,
and
<big>
are removed. The reason is that
this functionality can be achieved easily through CSS. Probably due to the much larger use that page
authors made over the years, HTML5 still supports elements such as
<b>
(for bold text) and
<i>
(for
italic text) that are logically equivalent to the now unsupported
<u>
and
<big>
elements.
Collecting data
HTML was originally devised to be a language for creating hypertext documents. Over the years, the
language has been enriched with layout capabilities and basic features to collect data. Writing input
forms to collect data from users proved to be a nontrivial task. One thing is to collect plain text; it is
quite another to collect a date, a number, or an email address.
For too many years, HTML has only offered input text fields completely unable to distinguish
numbers, dates, and email addresses from plain text. Subsequently, page developers were responsible
for preventing users from typing unwanted characters and for client validation of the entered text.
With HTML5, a lot of this work has been pushed to the browser side. This means that by simply
using a slightly more sophisticated set of elements developers can achieve the same level of form
validation in a faster and safer way.
Search WWH ::
Custom Search