Can an html element have multiple ids?

前端 未结 18 2363
天命终不由人
天命终不由人 2020-11-22 07:40

I understand that an id must be unique within an HTML/XHTML page.

My question is, for a given element, can I assign multiple ids to it?

18条回答
  •  遇见更好的自我
    2020-11-22 08:21

    My understanding has always been:

    • ID's are single use and are only applied to one element...

      • Each is attributed as a Unique Identifier to (only) one single element.
    • Classes can be used more than once...

      • They can therefore be applied to more than one element, and similarly yet different, there can be more than one class (i.e. multiple classes) per element.

提交回复
热议问题