<fieldset>

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O
Type

The FIELDSET element defines a group of related form fields.


<fieldset></fieldset>

The fieldset is usually displayed as a box with borders
Yes No
The fieldset can be captioned using the LEGEND element
Fieldset Caption Yes No

Example


<form method="POST" action="example.cgi">

<fieldset>

<p>Name :<br>
<input type="text" mame="name" size="30"></p>
<p>Telephone number :<br>
<input type="text" mame="telephone" size="30"></p>
<p>E-mail address :<br>
<input type="text" mame="email" size="30"></p>

</fieldset>

<fieldset>

<p>Question 1 :
<input type="radio" name="q1" value="yes"> Yes
<input type="radio" name="q1" value="no"> No
</p>
<p>Question 2 :
<input type="radio" name="q2" value="yes"> Yes
<input type="radio" name="q2" value="no"> No
</p>
<p>Question 3 :
<input type="radio" name="q3" value="yes"> Yes
<input type="radio" name="q3" value="no"> No
</p>

</fieldset>

<p>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</p>

</form>

Output

Name :

Telephone number :

E-mail address :

Question 1 : Yes No

Question 2 : Yes No

Question 3 : Yes No

This form cannot submit because of a sample.

Example of applying CSS to the FIELDSET element

<fieldset style="margin-bottom: 20px; padding: 20px; background-color: #ffffff;">

Output

Name :

Telephone number :

E-mail address :

Question 1 : Yes No

Question 2 : Yes No

Question 3 : Yes No

This form cannot submit because of a sample.