Can a label only refer to input elements?

后端 未结 4 1259
有刺的猬
有刺的猬 2021-02-13 11:16

W3Schools have this to say about labels:

The tag defines a label for an input element. [Emphasis mine]<

4条回答
  •  再見小時候
    2021-02-13 11:38

    According to the W3C it applies to Form Controls, and Form Controls are defined as:

    • Buttons
    • Checkboxes
    • Radio buttons
    • Menus
    • Text input
    • File select
    • Hidden controls
    • Object tags

    So FireFox is technically right, although I'd hardly consider it to be "breaking" if a browser didn't restrict it to those elements.

提交回复
热议问题