表单输入过滤html_HTML表单:输入辅助功能

表单输入过滤html

is the concept of making the world as usable as possible for people of differing abilities. You see examples of accessibility every day: wheelchair access ramps on stairs, or braille on elevator buttons. While it is not yet legally required in most counties for websites, the principles of accessibility are strongly advised as best practices. Used well, accessibility makes your site easier to use for everyone.

是使不同能力的人尽可能利用世界的概念。 您每天都会看到无障碍设施的示例:楼梯上的轮椅通道坡道,或电梯按钮上的盲文。 尽管在大多数国家/地区,法律对网站的使用尚无法律要求,但强烈建议将可访问性原则作为最佳做法。 如果使用得当,可访问性使您的网站更容易为所有人使用

The fact that we have been using clear, semantic fulfills a big part of the guidelines of accessibility. In the context of forms, there are two other attributes we should add to our <label> tag:

我们一直在使用清晰的语义的事实满足了可访问性准则的很大一部分。 在表单的上下文中,应将其他两个属性添加到<label>标记中:

The first is the for attribute. Used correctly, for links a label to the appropriate form element, meaning that a user can click on the for to make the appropriate <input> active, rather than having to guide the mouse and click (useful for site users with diminished hand-eye co-ordination, for example).

第一个是for属性。 正确使用, for链接一个标签到适当的形式元件,这意味着用户可以在点击for进行适当的<input>活性,而不是引导鼠标点击(用于网站用户具有降低的手眼协调)。

for takes the value of whatever id is set to in the appropriate form element:

for会在适当的表单元素中获取设置为id的值:

<label for="city">City</label>
<input type="text" name="city" id="city">

Alternatively, you can wrap the input with the label; if you do so, you can drop the for attribute:

或者,您可以使用标签包装输入。 如果这样做,则可以删除for属性:

<label for="city">City
	<input type="text" name="city" id="city">
</label>

The second attribute is accesskey. This creates a keyboard shortcut so that users with disabled access can hit a key, rather than using the mouse. It is usually (but not always) the first letter in the label content, and must be unique to each element in a form:

第二个属性是accesskey 。 这将创建一个键盘快捷方式,以便具有禁用访问权限的用户可以击键,而不是使用鼠标。 它通常是(但并非总是) label内容中的第一个字母,并且对于表单中的每个元素必须是唯一的:

<label for="city" accesskey="c">City</label>
<input type="text" name="city" id="city">

翻译自: https://thenewcode.com/165/HTML-Forms-Input-Accessibility

表单输入过滤html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值