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

后端 未结 8 1113
一生所求
一生所求 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:05

    If it counts for anything, frameworks like ASP.NET put the label element next to the input/select/textarea elements and use the label's for attribute.

提交回复
热议问题