Is it important to use lt;labelgt; in HTML?(使用lt;labelgt;重要吗?在 HTML 中?)
问题描述
对不起,这个问题可能很愚蠢,但我的好奇心让我很生气,而且我是新手,但在你的标记中使用标签很重要,为什么?
Excuse me for the maybe very stupid question, but my curiosity is killing me, and plus I'm new to this, but are using labels important in your markup, and why?
即
<label for="birthdate">Birthdate:</label>
<input type="text" id="birthdate" name="birthdate" />
为什么我必须标记这个输入,为什么它对用户有益,为什么对将来的使用有益,或者它是搜索引擎优化的事情.这就是我真正想知道的:)
Why must I label this input, why is it beneficial to the user, why is going to be beneficial for future use, or is it search engine optimization thing. That's what I really wanna know :)
推荐答案
这很重要,原因有很多:
It's important for a number of reasons:
- 点击标签聚焦于
文本字段,这是很多东西的用户期望. - 这对可访问性的原因很有帮助.
- 用户如何知道哪个字段是哪个?你可以使用只是文本或跨度或其他东西,但是你为什么要?
- 这会导致更多语义标记.
这篇关于使用<label>重要吗?在 HTML 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用<label>重要吗?在 HTML 中?


基础教程推荐
- 如何添加到目前为止的天数? 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01