Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Markup (HTML, XHTML, XML) _ how to use anchor within a page

Posted by: Mar 13 2019, 09:38 PM

Need help with I'm trying to insert links to the top - "Top "- and middle of the page - "Medical complaints and other uses". Problem is I can't arrive to the exact location without adding dummy divs, margin-top and margin-bottom. Appreciate any suggestions how I can make this a more exact science without having to use these extra positioning props.
Thanks for any help

Posted by: Christian J Mar 14 2019, 09:59 AM

You don't need to use A elements like this:

<a name="foo"></a>

instead you can just give any HTML element (in the BODY section) an ID, like this:

<header id="foo">...

and link to it as usual:

<a href="#foo">...

The "top" destination is easy, just add the ID to an element as early/high as possible (of course a desktop PC user could also the Home key). For the "complaints" section, add an ID to the elements surrounding the heading (this may or may not end up in the exact middle of the page, depending on window and text size).

BTW, this is a typo:

<lable>Click to see</lable>

--it should be LABEL, and it needs a FOR attribute unless it's associated with a child form element. See also

Posted by: orion88 Feb 13 2020, 11:33 AM

I created an anchor in my I want to link from an external site to the anchor on the "chicagoEtymology.html". Please help. Thanks You, Carl

Posted by: pandy Feb 13 2020, 07:38 PM

See this FAQ entry.

Except, as Christian explains above, we don't need name anymore.

Powered by Invision Power Board (
© Invision Power Services (