← TechnologyThe essentials of

fieldset and legend: related fields with a common question

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 21 Oct 2026 10:36. This is not editorial approval.

In a few sentences

In brief

The group gets its own title, instead of the relationship between the fields being passed only with a layout.

Useful to know

<fieldset> groups related controls, and <legend> sets the group title. This is suitable for example for several radio buttons that answer one question. Self-labels remain necessary for individual responses. [1]

When selecting "Way of delivery " legend can contain the question, and the labels to be "To Address" and "To Office". Thus, the group and each option have different, clear roles. The frame that the browser often displays by default can be styled separately.

The disabled attribute on fieldset excludes controls in the group, with an important exception for the contents of the first legend. [1] Do not use only grey to denote excluded fields: this does not change their actual behavior. Grouping is semantics, while visible spacing and frames are a matter of presentation.

Sources

For further detail and to check the information:

  1. [1] MDN — fieldset ↗