使用“标签为"在单选按钮上

2022-01-21 00:00:00 label radio-button html section508

在单选按钮上使用label for"参数时,要508 兼容*,下面的说法正确吗?

When using the "label for" parameter on radio buttons, to be 508 compliant*, is the following correct?

 <label for="button one"><input type="radio" name="group1" id="r1" value="1" /> button one</label> 

还是这个?

 <input type="radio" name="group1" id="r1" value="1" /><label for="button one"> button one</label>

我问的原因是,在第二个示例中,标签"仅包含文本,而不包含实际的单选按钮.

Reason I ask is that in the second example, "label" is only encompassing the text and not the actual radio button.

*1973 年《康复法案》第 508 条要求联邦机构向残障人士提供软件和网站可访问性.

*Section 508 of the Rehabilitation Act of 1973 requires federal agencies to provide software and website accessibility to people with disabilities.

推荐答案

你几乎明白了.应该是这样的:

You almost got it. It should be this:

<input type="radio" name="group1" id="r1" value="1" />
<label for="r1"> button one</label>

for 中的值应该是您要标记的元素的 id.

The value in for should be the id of the element you are labeling.

相关文章