Can an html element have multiple ids?

前端 未结 18 2533
天命终不由人
天命终不由人 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:09

    No. Every DOM element, if it has an id, has a single, unique id. You could approximate it using something like:

    and then use navigation to get what you really want.

    If you are just looking to apply styles, class names are better.

提交回复
热议问题