A szerkesztő azért "nyúl bele" az általad készített kódba, mert egy oldalon belüli hivatkozás (horgony, anchor) esetén az <a> tag elhelyezése így helyes. A horgony nem foghat át több tag-et, ahogy azt az általad kívánt kódban tetted.
Horgony használata esetén a dokumentum egy pontját lehet/szabad célként megjelölni, ahogy a
W3Schools mintaoldalon
is bemutatják:
Code:
<!DOCTYPE html>
<html>
<body>
<h2 id="top">Top of page!</h2>
<p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since.</p>
<p>"Whenever you feel like criticizing any one," he told me, "just remember that all the people in this world haven't had the advantages that you've had."</p>
<p>He didn't say any more, but we've always been unusually communicative in a reserved way, and I understood that he meant a great deal more than that. In consequence, I'm inclined to reserve all judgments, a habit that has opened up many curious natures to me and also made me the victim of not a few veteran bores. The abnormal mind is quick to detect and attach itself to this quality when it appears in a normal person, and so it came about that in college I was unjustly accused of being a politician, because I was privy to the secret griefs of wild, unknown men.</p>
<a href="#top">Go to top</a>
</body>
</html>
A fenti példában a <h2> címszintű elem a cél, melyet a
"top" azonosítóval lát el:
<h2 id="top">,
és a dokumentum alján az <a> tag
href="#top" attribútumában adja meg, hogy a hivatkozásnak az legyen a célja:
<a href="#top">
A példádban, melyet meg szeretnál valósítani, a képen kívül belefoglaltad a <h3> és <h4> címszinteket és az azutáni <p> bekezdést is. Ez ráadásul a hivatkozás
célja, nem pedig maga a hivatkozás, melyre kattintva a célra lehetne/kellene ugrani.
Ez így nem jó.