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: 8,238
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

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

 



- Lo-Fi Version Time is now: 15th October 2019 - 04:23 PM