表单标签 508 合规性问题
我为表单元素创建的标签是否需要位于
<div style="display: none;">
<label for="somename">Some Name</label>
<!-- more labels.. //-->
</div>
<!-- insert lots of HTML here //-->
<form>
<input type="text" name="somename" id="somename">
<!-- insert more elems here //-->
</form>
Do labels that I create for my form elements need to be in the <form> body? for example would this be compliant:
<div style="display: none;">
<label for="somename">Some Name</label>
<!-- more labels.. //-->
</div>
<!-- insert lots of HTML here //-->
<form>
<input type="text" name="somename" id="somename">
<!-- insert more elems here //-->
</form>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
一般来说,该标签实际上并没有提供太多语义含义,除非您碰巧在页面上有超过 1 个表单,在这种情况下,表单标签指示它与哪些表单元素关联。
话虽这么说,标签也不依赖于它们的位置,因为它们通过该元素的 ID 与 1 个且仅 1 个其他元素绑定,所以不,您将其相对于它作为标签的元素放在哪里并不重要,但通常最好将标签放在元素附近。如果页面偏离它所描述的元素太远,我会质疑页面的语义有效性,并且确保文档的语义是可访问性的关键组成部分。 508 确实只需要尽最大努力实现可访问性,但很少有情况下拥有语义文档太难做到。
In general, the tag doesn't really provide much semantic meaning unless you happen to have more than 1 form on a page, in which case the form tag indicates what form elements it is associated with.
That being said, tags also do not depend on their location because they are tied to 1 and only 1 other element by that element's ID, so no, it doesn't matter where you put it in relation to the element it is a label for, but it is usually good practice to keep the label near the element. I would question the semantic validity of your page if it drifts too far from the element it describes, and making sure your document is semantic is a key component of being accessible. 508 does only require a best-effort for accessibility, but few and far between are the cases where having a semantic document is too hard to do.
不。理想情况下,它们应该位于与其相关的元素旁边,但并非必须如此。确实,508 标准看起来很模糊;其中一些是因为您可以尝试匹配的合规性级别不止 1 个。我总是发现优先级 1 508 的合规性低得令人沮丧。你几乎可以逃脱任何惩罚。我总是尝试做的两件事(至少)是
我认为第二步使我成为比第一步更好的可访问网站的开发人员,因为很明显,一些常见的事情令人沮丧(例如,在每个页面的顶部都有大量的导航链接 页面,至少没有某种方式可以跳过它们)。如果您已经在屏幕阅读器中检查您的网站,那么您可能已经领先了。
No. Ideally they'd be right next to the element they're related to, but they don't have to be. It is true the 508 standards seem vague; some of that is because there's more than 1 level of compliance you can try to match. I always found the Priority 1 508 compliance to be frustratingly low. You could get away with most anything. The two things I always tried to do (at a minimum) were
I think the second step made me a better developer of accessible websites than the first because it became obvious that some common things were frustrating (e.g., having a huge block of navigation links at the top of every page without at least some way to skip them). If you're already checking your sites in a screenreader, you're probably ahead of the game.
如果有人想知道,我安装了 Thunder 屏幕阅读器,并且我上面提供的格式是完全可以访问的。
If anyone is wondering, I installed Thunder screenreader and the format i provided above is perfectaly accessable.
您还可以使用
where
you can also use
where