Forum Moderators: open

Message Too Old, No Replies

linking a specific spot on another page

# and name

         

D_Blackwell

4:32 pm on Jul 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Evidently, it's been so long since I was asked to do it, I've forgotten how. I need to link to a specific spot on another page within the site. It's the "other page" part that's thrown me. Can someone send me back to school with the correct order of things?

pageoneresults

4:35 pm on Jul 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



<a name="bookmark-name">Bookmark Name</a>

And then in the link that points to that bookmark...

<a href="file.htm#bookmark-name>Bookmark Name</a>

They are actually referred to as destination anchors.

From the W3C - 12.1.3 Specifying anchors and links [w3.org]

name = cdata [CS]
This attribute names the current anchor so that it may be the destination of another link. The value of this attribute must be a unique anchor name. The scope of this name is the current document. Note that this attribute shares the same name space as the id attribute.

[edited by: pageoneresults at 4:40 pm (utc) on July 3, 2003]

Mohamed_E

4:39 pm on Jul 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On the target page:

<A NAME = "XYZ123">Optional name</A>Text you want to reach ...

On the referring page:

<A HREF="pagename.html#XYZ123">Anchor text</A>

<edit>As usual, I type too slowly :( </edit>

MWpro

5:24 pm on Jul 3, 2003 (gmt 0)

10+ Year Member



Not sure if this was covered on that page, but should we use <a name=... or <a id=..?
They both work the same for me in many browsers and I heard from someone once that name should be replaced by id (for xhtml I think?) Just wondering what the proper way is.

pageoneresults

5:29 pm on Jul 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



MWpro, you are correct. The name attribute is deprecated in XHTML and the id attribute is the replacement.

From the W3C - 4.10. The elements with 'id' and 'name' attributes [w3.org]

In reference to HTML4.0

From the W3C - 12.2.3 Anchors with the id attribute [w3.org]

D_Blackwell

5:52 pm on Jul 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was just a shade away from having had it right. Thanks. I've printed your responses and added them to my file of "little things I might forget".

The "id" I never would have thought of, but went with it because it works.