View Single Post
Old 08-04-2010, 09:20 AM   #4
charleski
Wizard
charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
You only need to include an href if you want the anchor to link back to something (ToC, index, etc). The id is the name of that particular anchor, the href is a pointer allowing the anchor to link to somewhere else.

E.g.:
Text.html:
<a id="XYZ_Text" href="Index.html#XYZ_Index">XYZ</a>

Index.html:
XYZ: <a id="XYZ_Index" href="Text.html#XYZ_Text">p16</a>

Click on 'XYZ' in the index and it'll take you to the page in the text where it's located. Click on 'XYZ' in the text and it'll take you back to the index entry for it.

If you don't need the link-back (which sounds like it's the case here), then you can drop the href (and the class, which is irrelevant since the anchor doesn't contain any text). So simply change them to <a id="p16" />.
Your html will then look like:

Text.html:
blah blah blah <a id="XYZ1" />XYZ blah
...
blah blah blah <a id="XYZ2" />XYZ blah

Index.html:
XYZ: <a href="Text.html#XYZ1">p16</a>, <a href="Text.html#XYZ2">p24</a>

Last edited by charleski; 08-04-2010 at 09:30 AM. Reason: Made the example clearer
charleski is offline   Reply With Quote