Welcome to WebmasterWorld Guest from 50.19.34.234

Forum Moderators: incrediBILL

Message Too Old, No Replies

Named anchor - proper usage?

     

smallcompany

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

WebmasterWorld Senior Member 5+ Year Member



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>


or

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


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.

Thanks

alt131

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

WebmasterWorld Senior Member 5+ Year Member



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>

encyclo

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

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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>

alt131

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

WebmasterWorld Senior Member 5+ Year Member



@smallcompany.
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

rocknbil

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

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



...and wonder about right usage.


Honorabel mention on fragment identifiers [webmasterworld.com]

smallcompany

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

WebmasterWorld Senior Member 5+ Year Member



Thanks.

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.

phranque

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

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



more on the subject from p1r...

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

rocknbil

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

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

Featured Threads

Hot Threads This Week

Hot Threads This Month