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: davidm.me Mar 13 2019, 09:38 PM

Hi,
Need help with http://florapalaestina-ethnobotany.org/?plant=alhagi-graecorum-boiss#top 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
David

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

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

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

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

CODE
<header id="foo">...

and link to it as usual:

CODE
<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:

QUOTE
<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 http://www.htmlhelp.com/reference/html40/forms/label.html

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

I created an anchor in my http://www.earliestchicagomaps.com/chicagoEtymology.html. 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.

https://htmlhelp.com/faq/html/links.html#named-anchor

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

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)