使用< label>是否重要?在HTML中? [英] Is it important to use <label> in HTML?

查看:116
本文介绍了使用< label>是否重要?在HTML中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,我可能很愚蠢的问题,但我的好奇心正在杀死我,加上我是新来的,但使用标签中的重要标签,为什么?



ie

 < label for =birthdate>出生日期:< / label> 
< input type =textid =birthdatename =birthdate/>

为什么我必须标记这个输入,为什么这对用户有好处,为什么会变得有益为将来使用,还是搜索引擎优化的事情。这是我真正想知道的:)

解决方案

有很多原因是很重要的:




  • 点击标签将重点关注

    文本字段,这是用户期望的
    元素。

  • 这对于可访问性原因很有帮助。

  • 用户还会知道哪个字段是哪个字段?您可以使用
    只是文本或跨度或某物,但
    您为什么要这样做?

  • 它会带来更多的语义标记。


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?

i.e.

<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:

  • Clicking the label focuses on the
    text field, which is something a lot of users expect.
  • It's helpful for the accessibility reasons.
  • How else is the user going to know which field is which? You could use just text or a span or something, but why would you?
  • It leads to a more semantic markup.

这篇关于使用&lt; label&gt;是否重要?在HTML中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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