我不知道为什么我在http://validator.w3.org/check检查我的页面时一直收到此错误错误是:
Line 235, Column 84: The for attribute of the label element must refer to a form control.
… <label for="name" style="line-height:24px;">Your Name</label><br>
Run Code Online (Sandbox Code Playgroud)
这是我的实际代码
<div>
<label for="name" style="line-height:24px;">Your Name</label><br>
<input class="css_form_namefield TooltipIstok " type="text" name="name" value="" style="width: 554px;" maxlength="50" >
</div>
Run Code Online (Sandbox Code Playgroud)
Sha*_*arr 24
如果在label元素中使用for属性,则必须匹配表单中input元素的id.
即
<label for="field-id" style="line-height:24px;">Your Name</label><br>
<input type="text" id="field-id">
Run Code Online (Sandbox Code Playgroud)
此页面可能对更多信息有所帮助.http://www.w3.org/TR/WCAG-TECHS/H44.html