使用“标签为"在单选按钮上 [英] Using "label for" on radio buttons

查看:22
本文介绍了使用“标签为"在单选按钮上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在单选按钮上使用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.

这篇关于使用“标签为"在单选按钮上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆