HTML and CSS Reference
In-Depth Information
Figure 2-11.
The appearance of a simple web form
This is just a simple example that shows the form structure. Forms generally follow
the following format:
• Enclose form components within a
form
element that defines the file
that will handle the form data when it is submitted.
• Define a number of controls for gathering input, such as text fields,
drop-down lists, radio buttons, and so on.
• Provide a button for submitting the form so that the entered data can
be retrieved and processed.
If you are at all familiar with forms, you may notice an unfamiliar attribute in the
previous example—
placeholder
, which adds grayed-out text in the
textarea
ele-
ment that provides a tip on what should be entered. The
placeholder
attribute is one
new attribute in HTML5, but it is barely the tip of the iceberg! There have been enorm-
ous changes to web forms in the latest specification. In addition to the new and updated
elements listed in
Table 2-11
, a large number of new input types can be created using
the
input
element, such as much-needed form inputs for e-mail addresses, phone num-
bers, dates and times, and more! You will have to wait until
Chapter 4
where these will
be covered in more depth. In the meantime, familiarize yourself with the basic form-
related elements and then let's move on for the moment to an overview of embedded
content elements.
Search WWH ::
Custom Search