HTML and CSS Reference
What more could possibly go into a form?
We've covered just about everything you'll regularly use in your forms, but there are
a few more items you might want to consider adding to your form répertoire. We're
including them here just in case you want to take your own form studies even further.
Fieldsets and legends
When your forms start getting large, it can be helpful to visually group
elements together. While you might use <div> s and CSS to do this,
HTML also provides a <fieldset> element that can be used to
group together common elements. <fieldset> makes use of a second
element, called <legend> . Here's how they work together:
Th e <field set> elem ent surr ounds a
se t of inpu t elemen ts.
Here's how the fieldset
and legend look in one
browser. You'll find
that browsers display
<input type="checkbox" name="spice" value="salt">
<input type="checkbox" name="spice" value="pepper">
<input type="checkbox" name="spice" value="garlic">
The password <input> element works just like the text <input>
element, except that the text you type is masked. This is useful
for forms that require you to type in a password, a secret code, or
other sensitive information that you may not want other people to
see as you type. Keep in mind, however, that the form data is not
sent from the browser to the server script in a secure way, unless
you make it secure. For more on security, contact your hosting
The password <input> element works
exactly like the text <input> element,
except the text you type is masked.
<input type="password" name="secret">