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

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

    according to http://www.w3.org/TR/2008/WD-WCAG20-TECHS-20080430/H44.html

    some assistive technologies do not correctly handle implicit labels

    So when you wrap, you may also want to provide the "for" attribute to the label element.

提交回复
热议问题