homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

Named anchor - proper usage?

 4:33 am on Oct 9, 2010 (gmt 0)

If I use named anchors to jump around the single page, and I have few of them on the top like:

<a href="#general">General</a>

how would you use the named anchor code?

<h3><a name="general">General</a></h3>


<a name="general"></a>

The first one is bit confusing for me as it renders like a link while it does nothing when you click on it. I think that could confuse the user. On other side I see it used in HTML examples and wonder about right usage.




 11:10 am on Oct 9, 2010 (gmt 0)

Hi smallcompany,
Is there a reason you can't use:
<h3 name="general">General</h3>
Or better, as name has been deprecated in favour of id:
<h3 id="general">General</h3>
If you must support name, then a lot of coders use:
<h3 name="general" id="general">General</h3>

 12:30 pm on Oct 9, 2010 (gmt 0)

There is no reason to use the
name attribute these days, so the use of id is the way to go:

<h3 id="general">General</h3>

 11:02 pm on Oct 9, 2010 (gmt 0)

There are good explanations for the reasons you see those code snippets at sitepoint:
id = [reference.sitepoint.com ]
and href=[reference.sitepoint.com ].

That said, if you have no reason to support name, I'm with encyclo on just using an id on your header - it's valid and works.

However, that still leaves the usability problem with user agents that will not change focus. Rather than loading up the code with dummy links as in the examples you've referred to (and the ones at sitepoint), I'd suggest using tabindex - it is designed to address this exact issue.

@encyclo Thanks for causing me re-think my initial post


 12:33 am on Oct 10, 2010 (gmt 0)

...and wonder about right usage.

Honorabel mention on fragment identifiers [webmasterworld.com]


 7:37 pm on Oct 12, 2010 (gmt 0)


I wonder why Dreamweaver CS3 does not recognize the ecyclo's suggested way. I see a sole ID right in H tag (or any tag) works fine when I test it in FF or IE8. Yet, not seeing it in design view while developing may pose a problem if the site is more then simple and with lot of pages.

tabindex unfortunately does not work with the mouse.


 10:52 am on Oct 13, 2010 (gmt 0)

more on the subject from p1r...

Fragment Identifiers aka Named Anchors:
http://www.webmasterworld.com/accessibility_usability/3996219.htm [webmasterworld.com]


 4:12 pm on Oct 13, 2010 (gmt 0)

THAT's the one I was looking for.:-)

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved