The <legend>...</legend> element, in tandem with the HTMLFieldSetElement, provides a visually appealing grouping of form controls. The field set element presents a box around the form controls its markup contains. The legend element presents a title for the field set element, over the box outline.
Listing 25.6 demonstrates the correct usage of field set and legend elements. Figure 25.1 shows what they look like when a browser renders them.