Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anchor inside <h1> tag

Tags:

html

anchor

I have a little problem, maybe a stupid one, but a problem:

On my page I have a anchor-menue. In the past this worked very well, but now it suddenly stopped working. Interesting fact is that only anchors inside elements stopped working.

For example:

<h1><a name="anchor1" id="anchor1"></a>Nice little headline goes here</h1>

This one dosn't work, but this one works:

<a name="anchor2" id="anchor2"></a>

The website with the problem is: www.kleinbild.org

The anchor in code-line 126 on index-page with the ID "pagetop" is working pretty well for example, but the one in line 155 with the ID "anker1" don't.

I've now tried to put some Text inside the anchor like Luke suggested me, but the result is the same. Little example:

<h1><a name="anchor1" id="anchor1">Nice little headline goes here</a></h1>

Now the question of all questions is: why? I would be very glad if someone could give me an answere for this little problem. Thanks a lot!

like image 918
aklein Avatar asked Mar 23 '23 04:03

aklein


1 Answers

I suspect one of the possible issues is that your link inside your h1 tag has no text inside it.

You have this:

<h1><a name="anchor1" id="anchor1"></a>Nice little headline goes here</h1>

But don't you really want this?

<h1><a name="anchor1" id="anchor1">Nice little headline goes here</a></h1>
like image 99
Luke Avatar answered Apr 06 '23 01:04

Luke