HTML and CSS Reference
In-Depth Information
Example 2.25: A simple form with
input
elements
(continued)
<h2 align="center">Join Us!</h2>
<form method="post" action="mailto:info@example.com?subject=new+user">
<fieldset style="background-color: #eee">
<legend><strong>
Entry Form:
</strong></legend>
<p>
Your Name:
<input type="text" name="fullname" size="40" required/></p>
<p>
Your Email:
<input type="email" name="email" size="40" required/></p>
<p>
Your Age:
<input type="number" name="age" size="3" required maxlength="3"/>
<small>
You must be over 18 years of age
</small></p>
<p>
Web Page:
<input type="url" name="web" value="http://" size="40"/></p>
</fieldset>
<p><input type="submit"/> <input type="reset"/></p>
</form>
</body>
</html>
Figure 2.25 shows how the page created by Example 2.25 appears in a typi-
cal browser. he
ieldset
element used in Example 2.25 is an optional block
element that groups form input and control elements. By default, a thin border
is drawn around a ieldset. Example 2.25 applies a light gray background for
additional highlighting by using a
style
attribute. A
legend
element provides a
title for the ieldset.