Does the use of the fieldset HTML tag have meaning beyond grouping forms?

后端 未结 6 2009
予麋鹿
予麋鹿 2021-01-17 07:16

Usually, I\'ve seen it with forms, but I\'ve found it helpful to group related sets of data (eg when you have multiple tables on a page, using a fieldset around each table o

6条回答
  •  误落风尘
    2021-01-17 08:01

    If you want to group tables, consider using an appropriate heading (h1-h6) element for each group. Individual tables can be described using the 'caption' element. The 'summary' attribute is also available for each table.

    From the spec:

    Each table may have an associated caption (see the CAPTION element) that provides a short description of the table's purpose. A longer description may also be provided (via the summary attribute) for the benefit of people using speech or Braille-based user agents.

    And for the record, the 'fieldset' element is not intended to be use outside of forms. And within forms, it is intended to conceptually group like input fields - things like 'personal information' or 'billing address', etc.

    Here's an interesting article that discusses what screen-reader users hear when navigating fieldsets. http://www.rnib.org.uk/wacblog/articles/too-much-accessibility/too-much-accessibility-fieldset-legends/

提交回复
热议问题