We've already learned to use the anchor <a> tag to link to other web pages. Here we learn to jump to the middle of those pages. Before we can do this, we must learn a second use for the anchor tag.
The anchor tag is used in two ways:
<h4>This Heading is Marked.<a id="mark"></h4>
Now that we have a destination marker, we can link to it as follows:
<a href="#mark">Go to the Marked Heading </a>and producing the link:
Clicking the link moves the marked heading to the top of the page.
Insert a destination anchor at the spot where you wish to open the page. For example:
<h4>The Incredible Auk <a id="auk"> </h4>
The code for the link anchor uses a # to append the destination id to the file URL. Thus:
Click here to learn about <a href="htmwrite.html#auk"> The Incredible Auk </a>.produces the result:
Click here to learn about The Incredible Auk .
Whether you can do this depends on whether the web page author placed a destination anchor in his page at the spot where you need it. If so, he most likely has a link to that spot too.
If you find such a link, you can learn the id (or name) of the marker anchor by viewing the source code of the web page. Right click on the page, then click "View Source".
Append the destination id to the web page URL with a #, and use it as the href in your link anchor. For example:
<a href="http://www.yourhtmlsource.com/myfirstsite/basiclinks.html#STRUCTURE" target="_top"> Another View of Links </a>
Another View of Links from Your HTML Source, by Ross Shannon.
Copyright 2006 by Nancy E. Knox