网址:www.w3schools.com/tags/tag_la…
label能够为下列HTML元素定义标签:
使用label的两个收益:
- Screen reader users (will read out loud the label, when the user is focused on the element)
当用户focus在被label标签修饰的元素上时,Screen reader能够读出标签的文本
- Users who have difficulty clicking on very small regions (such as checkboxes) - because when a user clicks the text within the element, it toggles the input (this increases the hit area).
假设checkbox被label修饰,通常checkbox都是屏幕的狭小区域,如果用户对点击这种狭小区域感到困难,那么点击label文本,能达到同样的效果,即label的音乐,扩大了hit area的范围。