HTML <fieldset> Tag


ATTENTION: THIS PAGE IS Valid HTML 5 AND IS BEST VIEWED WITH HTML 5 - Please upgrade your browser or download one of the HTML 5 compatible browsers such as Mozilla Firefox, Chrome, Opera or IE 9 (March 14, 2011 or later). For more information see HTML 5 browsers.

If you find this helpful, please click the Google +1 Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.)

PDF mobile

The <fieldset> Tag in HTML 5

The <fieldset> tag is used to label a set of related fields, usually in an HTML form. It is one of the sectioning root tags, which means that the sections and headings inside the fieldset element are not included in the outline of any higher level sections.

<fieldset> Tag Syntax

   ... flow content expected ...
   <form id="form-id" method="GET|POST|etc." action="target-URL">
      ... phrasing content expected ...<fieldset>... phrasing content ...
      ... phrasing content ...</fieldset>...
   ... phrasing content expected ...<fieldset form="form-id">... phrasing content ...
   ... phrasing content ...</fieldset>...
Rules for coding HTML fieldset elements

Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.

  1. Code the fieldset element where phrasing content is expected, usually inside a form element.
  2. Begin the fieldset element with a starting <fieldset> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the xmlns attribute on the <html> tag.
  3. If the field set is for a form that can be submitted but is outside that form element, include a form attribute referencing the form the fieldsetis to be associated with.
  4. Include any other attributes on the <fieldset> tag as appropriate.
  5. Inside the fieldset element, between the starting <fieldset> tag and the ending </fieldset> tag, code the inner HTML phrasing content.
  6. End the fieldset element with a matching </fieldset> closing tag.
Content Model
Contents of the fieldset element
optional <legend> tag
The first child element of a <fieldset> tag may be a <legend> tag.

The content of the fieldset element can include HTML comments, text content and only those HTML tags that can be used in phrasing content.

<fieldset> Tag Attributes

Attributes of the <fieldset> tag
global attributes In addition to the personal attributes of the <fieldset> tag below, any of the common HTML attributes can also be coded.

<fieldset> Tag Examples

Examples of the fieldset tag in HTML 5
Radio Buttons On

Changes in HTML 5 - <fieldset> Tag

What's new in HTML 5

The disabled="disabled" and form attributes have been added.

Differences between HTML 5 and earlier versions of HTML

The 2000-2010 Recommendations from the W3C HTML Working Group defined the HTML namespace for the fieldset element type name along with the names of all HTML element types. In older (pre-2000) versions of HTML, element type names were not associated with a namespace.

Valid HTML 5