p vs. ol or ul for form styling

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

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

7条回答
  •  执笔经年
    2021-02-01 07:34

    Generally, forms fields are neither paragraphs nor list items, semantically speaking. If you require your form fields to be grouped together,

    s with classes are likely most appropriate, but if you're just looking for a container around the / pair, consider the alternate method for associating a label with a field:

    You can then style or manipulate them together without an artificial wrapper (and without ever having to worry about for= again).

提交回复
热议问题