HTML <fieldset> tagS2C Home   « HTML <fieldset> tag

Definition

The <fieldset> tag is used for grouping form elements together.

Example


<form action="html4intermediate/simpleform.html" method="get">
  <fieldset>
    <legend>Pie Survey</legend>	
    <p>Name:<input type="text" name="name" /></p>
    <p>Which pie do you prefer?:</p>
    <p><input type="radio" name="pie" checked="checked" value="chicken" /> Chicken</p>
    <p><input type="radio" name="pie" value="fish" /> Fish</p>
    <p><input type="radio" name="pie" value="shepherds" /> Shepherds</p>
    <p>Select a pie shape:</p>
    <p><select>
      <optgroup label="Normal">
        <option value="round">round</option>
        <option value="square">square</option>
      </optgroup>
      <optgroup label="Custom">
        <option value="hexagon">hexagon</option>
        <option value="star">star</option>
        <option value="triangle">triangle</option>
      </optgroup>
    </select></p>
    <p>Submit your information:</p>
    <p><button type="submit" value="Submit">Submit</button></p>
  </fieldset>
</form>

Required Attributes

NONE

Optional Attributes

NONE

Common Attributes

class - specifies a classname for the element allowing you to apply the style of the predefined class to the content.


<fieldset class="classname"></fieldset>

id - specifies a unique id for the element allowing you to apply the style of the predefined id to the content.


<fieldset id="idname"></fieldset>

style - specifies an inline style for the element allowing you to apply the style to the content.


<fieldset style="color:red;text-align:left"></fieldset>

title - specifies extra information about the content.


<fieldset title="information about the content"></fieldset>

Language Attributes

dir - specifies the directional flow of the content.


<!-- The text will flow from left to right -->
<fieldset dir="ltr"></fieldset>

<!-- The text will flow from right to left -->
<fieldset dir="rtl"></fieldset>

lang - specifies a language code for the content of the element.


<fieldset lang="en"></fieldset>

xml:lang - specifies a language code for the content of the element in XHTML documents.


<fieldset xml:lang="fr"></fieldset>

Document Event Attributes

NONE

Form Event Attributes

NONE

Image Event Attributes

NONE

Keyboard Event Attributes

onkeydown - The JavaScript code to be run when an element is in focus and keyboard key is pressed.


<!-- Executes the go() function -->
<fieldset onkeydown="go()"></fieldset>

onkeypress - The JavaScript code to be run when an element is in focus and keyboard key is pressed down and released.


<!-- Executes the go() function -->
<fieldset onkeypress="go()"></fieldset>

onkeyup - The JavaScript code to be run when an element is in focus and keyboard key is released.


<!-- Executes the go() function -->
<fieldset onkeyup="go()"></fieldset>

Mouse Event Attributes

onclick - The JavaScript code to be run when a mouse is clicked on the element.


<!-- Executes the go() function -->
<fieldset onclick="go()"></fieldset>

ondblclick - The JavaScript code to be run when a mouse is double clicked on the element.


<!-- Executes the go() function -->
<fieldset ondblclick="go()"></fieldset>

onmousedown - The JavaScript code to be run when the mouse button is pressed down while the cursor is over the element.


<!-- Executes the go() function -->
<fieldset onmousedown="go()"></fieldset>

onmousemove - The JavaScript code to be run when the mouse button is moved.


<!-- Executes the go() function -->
<fieldset onmousemove="go()"></fieldset>

onmouseout - The JavaScript code to be run when the mouse cursor moves off an element.


<!-- Executes the go() function -->
<fieldset onmouseout="go()"></fieldset>

onmouseover - The JavaScript code to be run when the mouse cursor moves over an element.


<!-- Executes the go() function -->
<fieldset onmouseover="go()"></fieldset>

onmouseup - The JavaScript code to be run when the mouse button is released while the cursor is over the element.


<!-- Executes the go() function -->
<fieldset onmouseup="go()"></fieldset>

go to home page Homepage go to top of page Top