HTML Tag Reference - HTML tag <fieldset>








This element groups <form> elements together by drawing a rectangle around all elements within its opening and closing tags.

Browser compatibility

<fieldset> Yes Yes Yes Yes Yes

What's new in HTML5

New attributes are being added in HTML5 for fieldset.

Attribute

disabled
Value:disabled
disable the fieldset
form
Value:form_id
Set for owner form id
name
Value:text
Set a name for the fieldset

Global Attributes

The <fieldset> tag supports the Global Attributes in HTML.

Event Attributes

The <fieldset> tag supports the Event Attributes in HTML.





Default CSS Settings

fieldset { 
    display: block;
    margin-left: 2px;
    margin-right: 2px;
    padding-top: 0.35em;
    padding-bottom: 0.625em;
    padding-left: 0.75em;
    padding-right: 0.75em;
    border: 2px groove (internal value);
}




Example

A demo showing how to use <fieldset> tag.

<html>
<body>
  <form name="form1" method="post" action="">
    <p>
    <fieldset>
      <input type="text" 
             name="textfield"
             value="First text field in first fieldset" 
             size="60"/><br/>
      <input type="text" 
             name="textfield2"
             value="Second text field in first fieldset" 
             size="50"/>
    </fieldset>
    </p><!--from w w  w.j a v a2 s .  c om-->
  </form>
</body>
</html>

Click to view the demo