Warning: include() [function.include]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/graberp/public_html/library/kbase/archives/2005/02/page_anchors_ar.php on line 29

Warning: include(http://www.grabers.com/lib/headNav.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/graberp/public_html/library/kbase/archives/2005/02/page_anchors_ar.php on line 29

Warning: include() [function.include]: Failed opening 'http://www.grabers.com/lib/headNav.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/graberp/public_html/library/kbase/archives/2005/02/page_anchors_ar.php on line 29

« Two Column Lists in CSS | Main | Autorun Issues on Windows/Mac »

February 22, 2005

Page anchors are really IDs

I noticed a finer point in inter-page navigation and the use of the DOM. An anchor is really just another ID. This realization opens some new doors.

Consider the following - used to as a link to a different section of a page.

‹a href="#anchor"› The is the link text ‹/a ›

Generally, when linking to another part of the page, you insert an 'anchor tag' where you want to jump to. Like so:

‹a name="anchor"›‹/a›

Here's the point: if have a markeup element with the ID set to say 'anchor', there is no need to add the ‹a› ‹/a› tags. Such as

‹h1 id="anchor"›The Title Blah Blab ‹/h1 ›

The navigation still works. No need to add anything else. The ID is the anchor name. A subtle but powerful point.


This is another example how CSS and the DOM change the coding paradigm within well built pages.


Posted by pgraber at February 22, 2005 06:06 PM


Warning: include() [function.include]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/graberp/public_html/library/kbase/archives/2005/02/page_anchors_ar.php on line 265

Warning: include(http://www.grabers.com/lib/footNav.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/graberp/public_html/library/kbase/archives/2005/02/page_anchors_ar.php on line 265

Warning: include() [function.include]: Failed opening 'http://www.grabers.com/lib/footNav.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/graberp/public_html/library/kbase/archives/2005/02/page_anchors_ar.php on line 265