Latest web development tutorials

HTML <fieldset> tag

Examples

To form a grouping related elements:

<form>
  <fieldset>
    <legend>Personalia:</legend>
    Name: <input type="text"><br>
    Email: <input type="text"><br>
    Date of birth: <input type="text">
  </fieldset>
</form>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support <fieldset> tag.


Tag definitions and instructions

<Fieldset> tag can be associated elements in the form of packets.

<Fieldset> tag draws a border around the related form elements.


Tips and Notes

Tip: <Legend> tag for the <fieldset> element defines the title.


Differences between HTML 4.01 and HTML5

HTML5 add some <fieldset> new attribute: disabled, form, name, HTML 4.01 does not support these attributes.


Attributes

New: HTML5 new property.

属性 描述
disabled New disabled 规定该组中的相关表单元素应该被禁用。
form New form_id 规定 fieldset 所属的一个或多个表单。
name New text 规定 fieldset 的名称。


Global Properties

<fieldset> tag supports HTML global properties .


Event Properties

<fieldset> tag supports HTML event properties .