The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> how to use anchor within a page
davidm.me
post Mar 13 2019, 09:38 PM
Post #1





Group: Members
Posts: 3
Joined: 30-January 09
Member No.: 7,680



Hi,
Need help with this page 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 14 2019, 09:59 AM
Post #2


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
orion88
post Feb 13 2020, 11:33 AM
Post #3





Group: Members
Posts: 1
Joined: 13-February 20
Member No.: 27,167



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 13 2020, 07:38 PM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



See this FAQ entry.

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

Except, as Christian explains above, we don't need name anymore.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 10:21 AM