Wednesday, September 21, 2011

How To Make An In-Page-Link

Linking from one web page to another is the fabric the web is made of. But sometimes this is to coars. Sometimes your informations are on just one page but heavily interrelated.
Thinking of a table of contents for a closed topic you don't want to split up into single pages because every chapter is in the size of a couple of lines.

The solution are in page links. There are two ways of doing this. The old anchor way or the new xhtml compliant way.

Old stuff first
This is not recommended anymore because not all browsers support the anchors anymore.
Place the anchor:
 <a name="headline1">This Is About Deprecated Anchors</a>  
Place the Link:
 <a href="#headline1">Anchors</a>  

New XHTML Compliant
Target:
 <div id="headline2">  
    The New Way To Code In-Page-Links  
 </div>  
Link:
 <a href="#headline2">the new way</a>  
Link from another web page:
 <a href="anotherwebpage.html#headline2">the new way</a>  

No comments:

Post a Comment