Placeholder VS Label for input in HTML5

后端 未结 3 854
无人共我
无人共我 2021-01-02 00:33

I\'m Making a form with multiple inputs where I need to give lable of form element inside input itself and I\'m using like this

An example

<

3条回答
  •  情深已故
    2021-01-02 01:07

    HTML validators will not check accessibility. Valid HTML can still be inaccessible or less than optimal. Labels are still important and HTML5 placeholder is not a replacement for them. See H44: Using label elements to associate text labels with form controls in the WCAG 2 Techniques. If your layout requires that the label not be visible to sighted users, you can always include the label but move it offscreen with negative margins/text-indent.

    Update:

    Some test result on placeholder and a discussion on the W3 Public HTML mailing list about using placeholder without label.

提交回复
热议问题