Why do we need a <fieldset>
tag? Whatever purpose it serves is probably a subset of the form tag.
I looked up some info on W3Schools, which says:
- The
<fieldset>
tag is used to group related elements in a form. - The
<fieldset>
tag draws a box around the related elements.
More explanation for those who are mistaking "why it exists in specification" for "what it does".
I think the drawing part is irrelevant, and I don't see why we need a special tag just to group some related elements in a form.
Best Answer
The most obvious, practical example is:
This allows each radio button to be labeled while also providing a label for the group as a whole. This is especially important where assistive technology (such as a screen reader) is being used where the association of the controls and their legend cannot be implied by visual presentation.