HTML and CSS Reference
In-Depth Information
What can go in a form?
You can put just about any element into a form, but that's not what we really
care about right now; we're interested in the
form elements that create controls in
the browser
. Here's a quick rundown of all the commonly used form elements.
We're going to start with the
<input>
form element, which plays many roles
in the form's world.
text input
The text <input> element is
for entering one line of text.
Optional attributes let you
set a maximum number of
characters and the width of
this control.
M
ost form elements requ
ire a name
th
at is used by the serve
r script. We'll
se
e how this works in a b
it.
Use
the
type
att
ribu
te to
indi
cate
you
want
a “
text
” inp
ut.
The <i
nput>
elemen
t is a
void e
lement
,
so the
re's no
conte
nt aft
er it.
<input type="text" name="fullname">
submit input
The
but
ton
is lab
eled
“Sub
mit”
(or
“Sub
mit
The submit <input> element creates
a button that allows you to submit a
form. When you click this button, the
browser sends the form to the server
script for processing.
Qu
ery”)
by
defa
ult,
alt
houg
h you
can
ch
ange
that
(we
'll
sho
w yo
u ho
w lat
er).
<input type="submit">