Name

fieldset — HTML 4.01 | HTML5

Synopsis

<fieldset> . . . </fieldset>

Establishes a group of related form controls and labels. fieldset elements are placed within the form element. It is similar to div but is specifically for grouping form fields and inputs. It was introduced to improve form accessibility for users with alternative browsing devices.

Start/End Tags

Required/Required

Attributes

Core, Internationalization, Events, HTML5 Global Attributes

disabled (disabled="disabled" in XHTML5)

HTML5 only. Disables the control for user input. It can be altered only via a script. Browsers may display disabled controls differently (grayed out, for example), which could be useful for dimming certain controls until required info is supplied.

form="id of the form owner"

HTML5 only. Explicitly associates the input control with its associated form (its form owner). With this method, the input control does not need to be a child of the form element that applies to it.

name="text"

HTML5 only. Assigns a name to the fieldset.

Example

<form>
<fieldset id="customer">
 <legend>Customer contact information</legend>
 <label>Full name <input type="text" name="name">
 </label>
  <label>Email Address <input type="text" name="email">
 </label>
  <label>State <input type="text" name="state"></label>
</fieldset>
</form>

Get HTML & XHTML Pocket Reference, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.