Which HTML element should a developer use to logically group a set of related HTML elements?
AnswerC
ExplanationThe <fieldset> element is used to group a set of related HTML elements in a form. It provides a way to logically group related controls and labels.
Fieldset Element: The <fieldset> element can be used to create a group of form controls, along with an optional <legend> element that provides a caption for the group.
Usage Example:
<fieldset>
<legend>Personal Information</legend>
<label for='name'>Name:</label>
<input type='text' id='name' name='name'>
<label for='email'>Email:</label>
<input type='email' id='email' name='email'>
</fieldset>
This groups the name and email input fields under the legend 'Personal Information'.
MDN Web Docs on <fieldset>
W3C HTML Specification on Fieldset