DEV Community

Cover image for HTML tags | fieldset
Carlos Espada
Carlos Espada

Posted on

HTML tags | fieldset

It is used to group related elements within a form. It usually generates a border around it, modifiable with CSS.

Besides name, it has two main attributes:

  • disabled to disable all form elements contained within the <fieldset> and not receiving navigation events (click, focus)
  • form to, taking as value the id of a <form>, associate the <fieldset> to said form even if it is not contained within it. The latter is confusing and is not recommended, if you want to establish that link it is better to associate the form elements it contains one by one.

A title can be set for each <fieldset> using <legend> as the first child.

  • Type: block
  • Self-closing: No
  • Semantic value: No

Definition | Example | Support

Discussion (0)