Is it better to wrap the label tag around a form item or use the “for” attribute in HTML?

后端 未结 8 1138
一生所求
一生所求 2020-12-02 16:26

I know that you can use both but is it better to use one over the other? If so, why?

Example of \"for\" attribute:



        
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 17:18

    Embedding the input in the label also affects the wrapping behaviour. will wrap as a single unit by default. Whereas will wrap the text with breaks at spaces and will wrap the label to a new line but leave the checkbox above.

提交回复
热议问题