Grouping Form Fields
Another means of making your forms more accessible is to group form information. You'll recall that in Chapter 4, “Creating Tables,” I showed you several ways to group table elements to make them more comprehensive. Well, the same concepts apply here, although different elements are used.
In the case of forms, you can break down areas of the form into specific sets of fields using the fieldset element. If you have a form with three contextual sections, such as Contact Information, Favorite Activities, and Reset or Submit, you can create fields around each of those. Then you can use the legend element to add a header for each of those sections, further providing context (see Example 5-14).
Example 5-14. Breaking forms ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access