HTML and CSS Reference
In-Depth Information
Using the fieldset element to organize form fields helps users understand the purpose
of the form and what's related. A fieldset may also be used to group sets of radio
buttons or checkboxes.
The legend and fieldset can both be styled using CSS. By default, most browsers
display a solid one-pixel border around the fieldset and the legend appears in the
upper-left corner of the container, overlaying the border, as shown in Figure 7-3 .
Figure 7-3. The default appearance of fieldset and legend in Opera 11
Another benefit of grouping form fields using the fieldset element is that the flow, or
ordering, of the form should make sense to keyboard users. Unless you do something
like modify the tabindex values, the tab order of a form usually follows the order that
the fields appear in in the source code.
The field order used to be more of a problem when tables were used for form layout.
The use of CSS for layout has greatly mitigated this problem because the fields can be
listed in a logical order in the source code and then positioned on the screen,
independent of the code order.
See Also
“Making Elements Focusable with Tabindex” at
_and_usability/elements_focusable_with_tabindex and the HTML5 fieldset specifica-
tion at .
Search WWH ::

Custom Search