Search code examples
phphtmlanchor

HTML Multiple Anchor Names


I'm wondering if it is possible to link to something that has more than 1 id?

For example: I want to link to a h4 tag using one id or another id but I want them to link to the same tag. Something like:

<h4 id=1 id=2>Title</h4>

So that the h4 tag can be linked to with #1 or #2

Is there anyway to do that?


Solution

  • No. It's not possible to have more than one id attribute of an element. As you have given like-

    <h4 id=1 id=2>Title</h4>
    

    Here the 1 will be accepted and rest of the value will be ignored. The w3c has given specification here. And the value for id attribute can be given as specified here