HTML and CSS Reference
In-Depth Information
The
<button>
control provides for a greater variety and richer contents
than its
<input>
analogs. Everything between the
<button>
and
</button>
tags becomes the content of the button, including any acceptable body
content, such as text or multimedia. For instance, you could include an
image and related text within a button, creating attractive labeled icons
in your buttons. The only
verboten
element is an image map because its
mouse- and keyboard-sensitive actions interfere with the form button.
9.6.2. The type Attribute
Use the
type
attribute for the
<button>
tag to define the button's action.
You should set its value to
submit
,
reset
, or
button
. Like its
<input>
analog, a
<button type=submit>
form element, when selected by the
user, tells the browser to package and send the contents of the form
to the forms-processing server or email it to the mailto recipient. Using
type=reset
creates a conventional reset button, and using
type=button
creates a conventional push button.
For example,
Figure 9-5
shows the following
exclaim.gif
icon inset on a
3D button that pushes in and pops back out when the user clicks it with
the mouse. In doing so, the browser submits the form to the server:
Figure 9-5. A form-submit <button>