Which element defines a caption for a fieldset?

Learn web design with our comprehensive test guide. Improve your skills with flashcards and multiple choice questions. Each question includes hints and explanations. Get ready to ace your exam!

Multiple Choice

Which element defines a caption for a fieldset?

Explanation:
The caption for a group of related form controls in a fieldset is provided by the legend element. Placing a legend inside a fieldset gives a label for the entire group, and screen readers will announce that label before the controls, helping users understand what the set of fields is about. The legend is usually the first child of the fieldset, and appears as a caption above the grouped inputs. This is distinct from the caption element, which is used for tables; the title element, which sets the page title; and the summary element, which is used with details for disclosure sections, not with fieldsets. For example, you’d write a fieldset with a legend like: <fieldset><legend>Contact information</legend> ... </fieldset>.

The caption for a group of related form controls in a fieldset is provided by the legend element. Placing a legend inside a fieldset gives a label for the entire group, and screen readers will announce that label before the controls, helping users understand what the set of fields is about. The legend is usually the first child of the fieldset, and appears as a caption above the grouped inputs. This is distinct from the caption element, which is used for tables; the title element, which sets the page title; and the summary element, which is used with details for disclosure sections, not with fieldsets. For example, you’d write a fieldset with a legend like:

Contact information ...
.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy