internal webpage links

Discussion in 'HTML' started by dorayme, Aug 31, 2005.

  1. dorayme

    dorayme Guest

    Anyone know this please? Is the construction

    <a id="something"></a>

    without anything between opening and closing
    tags kosher? That is, put at the place one wants the referring
    link to target. It seems to work ok in strict 4.01, but I have
    in the past avoided it. But if it is acceptable practice with no
    bad cons, it is mighty convenient (able to be simply cut and
    paste into the page just above the bit you want the link to go
    to).

    Or should one have to wrap it around something like a bit of
    text or an image:

    <h1><a id="something">This should appear</a></h1>

    dorayme
    dorayme, Aug 31, 2005
    #1
    1. Advertising

  2. dorayme

    Mark Parnell Guest

    Previously in alt.html, dorayme <> said:

    > <a id="something"></a>
    >
    > without anything between opening and closing
    > tags kosher?


    It's permitted by the specs, but I would recommend against it. The specs
    note:

    "Note. User agents should be able to find anchors created by empty A
    elements, but some fail to do so."

    While this is probably not relevant now (the specs *are* nearly 6 years
    old), any browser that can find an anchor by id can match the id on any
    other element too.

    Also, if you have any CSS rules like a {...}, they will apply to your
    empty anchors, as well as any actual links. You can avoid that by making
    sure you use a:link, but it's easier to avoid empty anchors.

    > <h1><a id="something">This should appear</a></h1>


    An id can go on any element, so the <a> is superfluous.

    <h1 id="something">This should appear</h1>

    --
    Mark Parnell
    http://clarkecomputers.com.au
    alt.html FAQ :: http://html-faq.com/
    Mark Parnell, Aug 31, 2005
    #2
    1. Advertising

  3. dorayme

    dorayme Guest

    > From: Mark Parnell <>

    > Previously in alt.html, dorayme <> said:
    >
    >> <a id="something"></a>
    >>
    >> without anything between opening and closing
    >> tags kosher?

    >
    > It's permitted by the specs, but I would recommend against it. The specs
    > note:
    >
    > "Note. User agents should be able to find anchors created by empty A
    > elements, but some fail to do so."
    >
    > While this is probably not relevant now (the specs *are* nearly 6 years
    > old), any browser that can find an anchor by id can match the id on any
    > other element too.
    >
    > Also, if you have any CSS rules like a {...}, they will apply to your
    > empty anchors, as well as any actual links. You can avoid that by making
    > sure you use a:link, but it's easier to avoid empty anchors.
    >
    >> <h1><a id="something">This should appear</a></h1>

    >
    > An id can go on any element, so the <a> is superfluous.
    >
    > <h1 id="something">This should appear</h1>
    >



    Thank you. I greatly appreciate this advice, especially the last bit about
    <a> being superfluous when using ids This will make life simpler.

    dorayme
    dorayme, Aug 31, 2005
    #3
  4. dorayme

    Toby Inkster Guest

    dorayme wrote:

    > <h1><a id="something">This should appear</a></h1>


    Use:
    <h1 id="something">This should appear</h1>

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Toby Inkster, Aug 31, 2005
    #4
  5. dorayme

    Ed Jay Guest

    Toby Inkster <> wrote:

    >dorayme wrote:
    >
    >> <h1><a id="something">This should appear</a></h1>

    >
    >Use:
    ><h1 id="something">This should appear</h1>


    Use <a name="foo"></a> at the location you want to link to on page
    xxx.html. Then point to it using <a href="xxx.html#foo">.

    Ed Jay (remove M to respond)
    Ed Jay, Aug 31, 2005
    #5
  6. dorayme

    Guest

    Ed Jay wrote:

    > Use <a name="foo"></a> at the location you want to link to


    No, don't do that (it's wrong for at least two, arguably three reasons)

    Just search this newsgroup or c.i.w.a.h instead.
    , Aug 31, 2005
    #6
  7. Ed Jay wrote:
    > Toby Inkster <> wrote:
    >
    >>dorayme wrote:
    >>
    >>> <h1><a id="something">This should appear</a></h1>

    >>
    >>Use:
    >><h1 id="something">This should appear</h1>

    >
    > Use <a name="foo"></a> at the location you want to link to on page
    > xxx.html. Then point to it using <a href="xxx.html#foo">.


    What's the advantage to doing that over naming the actual element you
    wish the link to take the user to?


    --
    Blinky Linux Registered User 297263

    Killing All Posts from GG: http://blinkynet.net/comp/uip5.html
    End Of The Good GG Archive GUI: http://blinkynet.net/comp/gggui.html
    Blinky the Shark, Aug 31, 2005
    #7
  8. dorayme

    Ed Jay Guest

    Blinky the Shark <> wrote:

    >Ed Jay wrote:
    >> Toby Inkster <> wrote:
    >>
    >>>dorayme wrote:
    >>>
    >>>> <h1><a id="something">This should appear</a></h1>
    >>>
    >>>Use:
    >>><h1 id="something">This should appear</h1>

    >>
    >> Use <a name="foo"></a> at the location you want to link to on page
    >> xxx.html. Then point to it using <a href="xxx.html#foo">.

    >
    >What's the advantage to doing that over naming the actual element you
    >wish the link to take the user to?


    Case of 'that's the way I've always done it.' No other good reason.

    Ed Jay (remove M to respond)
    Ed Jay, Aug 31, 2005
    #8
  9. Ed Jay wrote:
    > Blinky the Shark <> wrote:
    >
    >>Ed Jay wrote:
    >>> Toby Inkster <> wrote:
    >>>
    >>>>dorayme wrote:
    >>>>
    >>>>> <h1><a id="something">This should appear</a></h1>
    >>>>
    >>>>Use:
    >>>><h1 id="something">This should appear</h1>
    >>>
    >>> Use <a name="foo"></a> at the location you want to link to on page
    >>> xxx.html. Then point to it using <a href="xxx.html#foo">.

    >>
    >>What's the advantage to doing that over naming the actual element you
    >>wish the link to take the user to?

    >
    > Case of 'that's the way I've always done it.' No other good reason.


    What a brutally honest response. :)


    --
    Blinky Linux Registered User 297263

    Killing All Posts from GG: http://blinkynet.net/comp/uip5.html
    End Of The Good GG Archive GUI: http://blinkynet.net/comp/gggui.html
    Blinky the Shark, Aug 31, 2005
    #9
  10. dorayme

    Ed Jay Guest

    Blinky the Shark <> wrote:

    >Ed Jay wrote:
    >> Blinky the Shark <> wrote:
    >>
    >>>Ed Jay wrote:
    >>>> Toby Inkster <> wrote:
    >>>>
    >>>>>dorayme wrote:
    >>>>>
    >>>>>> <h1><a id="something">This should appear</a></h1>
    >>>>>
    >>>>>Use:
    >>>>><h1 id="something">This should appear</h1>
    >>>>
    >>>> Use <a name="foo"></a> at the location you want to link to on page
    >>>> xxx.html. Then point to it using <a href="xxx.html#foo">.
    >>>
    >>>What's the advantage to doing that over naming the actual element you
    >>>wish the link to take the user to?

    >>
    >> Case of 'that's the way I've always done it.' No other good reason.

    >
    >What a brutally honest response. :)


    You caught me at a weak moment when I was pizza deprived. :)

    Ed Jay (remove M to respond)
    Ed Jay, Aug 31, 2005
    #10
  11. Ed Jay wrote:
    > Blinky the Shark <> wrote:
    >
    >>Ed Jay wrote:
    >>> Blinky the Shark <> wrote:
    >>>
    >>>>Ed Jay wrote:
    >>>>> Toby Inkster <> wrote:
    >>>>>
    >>>>>>dorayme wrote:
    >>>>>>
    >>>>>>> <h1><a id="something">This should appear</a></h1>
    >>>>>>
    >>>>>>Use:
    >>>>>><h1 id="something">This should appear</h1>
    >>>>>
    >>>>> Use <a name="foo"></a> at the location you want to link to on page
    >>>>> xxx.html. Then point to it using <a href="xxx.html#foo">.
    >>>>
    >>>>What's the advantage to doing that over naming the actual element you
    >>>>wish the link to take the user to?
    >>>
    >>> Case of 'that's the way I've always done it.' No other good reason.

    >>
    >>What a brutally honest response. :)

    >
    > You caught me at a weak moment when I was pizza deprived. :)


    Just a flesh wound. :)

    --
    Blinky Linux Registered User 297263

    Killing All Posts from GG: http://blinkynet.net/comp/uip5.html
    End Of The Good GG Archive GUI: http://blinkynet.net/comp/gggui.html
    Blinky the Shark, Aug 31, 2005
    #11
  12. dorayme

    dorayme Guest

    > From: Toby Inkster <>
    >
    > dorayme wrote:
    >
    >> <h1><a id="something">This should appear</a></h1>

    >
    > Use:
    > <h1 id="something">This should appear</h1>
    >
    > --
    > Toby A Inkster BSc (Hons) ARCS
    > Contact Me ~ http://tobyinkster.co.uk/contact
    >


    Yes, thank you, as Mark Parnell suggested too. I am already
    changing every bit of appropriate mark-up on my sites (as I come
    across them in good time) to implement this. Nice and simple. I
    have always had a vague uncomfortable feeling using the anchor
    tags and even name="" even though all worked fine...

    dorayme
    dorayme, Sep 1, 2005
    #12
  13. dorayme

    jake Guest

    In message <BF3B50CB.166BE%>, dorayme
    <> writes
    >Anyone know this please? Is the construction
    >
    ><a id="something"></a>
    >
    >without anything between opening and closing
    >tags kosher? That is, put at the place one wants the referring
    >link to target. It seems to work ok in strict 4.01, but I have
    >in the past avoided it. But if it is acceptable practice with no
    >bad cons, it is mighty convenient (able to be simply cut and
    >paste into the page just above the bit you want the link to go
    >to).
    >
    >Or should one have to wrap it around something like a bit of
    >text or an image:
    >
    ><h1><a id="something">This should appear</a></h1>
    >
    >dorayme
    >


    I would tend to use :
    <h1><a name="something" id="something">INTRODUCTION.</a></h1>

    ( name="something" keeps it compatible with older browsers which don't
    support 'id')

    Or occasionally:

    <div style="width:100%;">
    <h1><a name="something" id="something">INTRODUCTION.</a></h1>
    </div>

    On the occasions when the page has to work 'keyboard-only' on IE and
    behave like other browsers when tabbing from link-to-link.

    regards.


    --
    Jake
    ( .... just a spam trap.)
    jake, Sep 1, 2005
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    422
  2. Paul
    Replies:
    14
    Views:
    845
    Alexey Smirnov
    Jun 19, 2008
  3. sifar
    Replies:
    5
    Views:
    420
  4. soren625
    Replies:
    2
    Views:
    376
    soren625
    Dec 12, 2006
  5. markvr
    Replies:
    4
    Views:
    116
    markvr
    Feb 9, 2007
Loading...

Share This Page