p vs. ol or ul for form styling

前端 未结 7 1813
醉梦人生
醉梦人生 2021-02-01 07:16

Typically I style forms with the unordered list tag e.g.

7条回答
  •  走了就别回头了
    2021-02-01 07:46

    The key things that the W3C lay out for forms is that the Form is set up in a way that the labels and form elements can be easily grouped programatically:

    1.3.1 Info and Relationships: Information, structure, and relationships conveyed through presentation can be programmatically determined or are available in text.

    In particular HTML Technique 44: Using label elements and HTML Technique 71: Providing a description.

    The advantage you get from wrapping each label and input in a list item is that the user with a screen reader may well get some indication at the begining that the list has x items in it, which might be useful.

    Generally though our designers are with Zack - our form rows are wrapped in a div, with a class of "formrow" or similar.

提交回复
热议问题