How do I group related form controls under one legend?
Quick answer
Wrap controls that belong together in a <fieldset> and use a <legend> inside it to describe the group. For example, “Notification preferences” can name related notification choices, while each choice still has its own label. This grouping-and-naming pattern appears in the cited form examples [S1][S2]. Those examples do not establish how every browser or assistive technology presents a group.
The question, the details, the next step.
A practical checklist
Group controls only when they share a clear topic.
Use a concise, specific legend to name each group.
Give each individual control its own clear label.
Distinguish nearby groups with names that are not interchangeable.
Follow the testing process appropriate to your project.
A few more useful answers
Can the legend replace the labels for the individual controls?
No. Use the legend to name the group and keep a clear label for each control, as illustrated by the grouped-fields example [S2].
Sources
References used for this guide.
- [S1] Build user-adaptive interfaces with preference media queries codelabs.developers.google.com · Checked
- [S2] Introducing ASP.NET Web Pages: Entering Database Data by Using Forms learn.microsoft.com · Checked
