When related fields appear together, a legend names their group and gives people context as they complete a form. Screen readers can announce the legend alongside each control’s label, such as “Name – Billing Details.” section 6.1.4
Use a legend with a fieldset to make related controls explicit both visually and programmatically. CSS borders alone do not communicate the group to assistive technology users. section 6.1.4
<fieldset> #A
<legend>Dog size</legend> #B
<div>
<input type="radio" name="size" id="small" value="s" checked> #C
<label for="small">Small</label>
</div>
<div>
<input type="radio" name="size" id="medium" value="m"> #C
<label for="medium">Medium</label>
</div>
<div>
<input type="radio" name="size" id="large" value="l"> #C
<label for="large">Large</label>
</div>
</fieldset>This example groups dog-size radio choices under the legend “Dog size.” section 6.1.4
