Wednesday, May 21, 2008

Anchoring Tags in HTML

Good explanation of creating anchors in HTML so you can link to a section of a page you've created, in order to jump to a particular point on the page from a link. I got this from Indiana University's coding pages:

  • You can also link to a specific part of another document that you have created. In the destination document you use the following markup:

    <a name="anchor name">text</a>

    In the main document, where the user will see the link, you put the following markup:

    <a href="pagename.html#anchor name">text</a>

    So in the destination document (which in this case is the Table of Contents (DemoCon.html), you would place the following markup tags somewhere on the page (in this case the last word of the first paragraph).

    <a name="Links">current</a>

    And in the document (this one) where the link appears, you would place the following markup tags in the place that will be the jumpoff point (which is the sentence that follows the markup example):

    <a href="DemoCon.html#Links">link</a>

    So it will look like this:

  • You can use this link to go to the section of the Table of Contents page with the link back to this page!


  • Just thought it was cool and wanted to share.

    No comments: