In a scenario where a form is used to capture various categories of information (e.g., Personal Info, Contact Info), how would you structure the HTML using fieldsets and legends to ensure clarity and semantic structure?

  • Use fieldsets for styling and avoid legends. 
  • Use fieldsets to group each category of information, and legends to title these groups. 
  • Use one legend for the entire form and separate categories with line breaks. 
  • Utilize a single fieldset for all categories and use CSS for category titles. 
Fieldsets are meant to group related controls and content. By using separate fieldsets for different categories of information, you're creating a clear and semantic boundary between these categories. Legends then serve as accessible and clear titles for each of these categories, enhancing the clarity and understandability of the form structure. 
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *