My anchor link is applying to the next paragraph

  ade.h 15:51 30 Aug 2006

XHTML set out as below:

p> a href="#anchor1"/>Anchor 1 /p>
p> a href="#anchor2"/>Anchor 2 /p>
p> a href="#anchor3"/>Anchor 3 /p>

hr />

div id="body">
p>Text in first paragraph. The anchors apply to the h2 headings in subsequent paragraphs /p>

The hyperlink that is created by Anchor 3 also applies to the first paragraph and I can't work out why. It validates fine. I have compared it with the much less tidy HTML from a basically identical NOF page and apart from the gunk that NOF adds, there's no difference. Yet the old NOF page doesn't suffer this.

I feel I'm missing something obvious....

  ade.h 15:52 30 Aug 2006

The forum's having a "no-left-chevrons" day again!

  Sethhaniel 16:18 30 Aug 2006

your temp files and cache - as the old page may be need refreshing to get change ??

  ade.h 17:35 30 Aug 2006

There's no old page involved directly in that sense, as it's on stored on another PC. I haven't viewed the old site project on this particular PC.

Besides, it can't be a cache issue.

The first paragraph is inheriting the hyperlink that is generated in the last of the anchor paragraphs and thus becoming a hyperlink in itself.

This phenomenon isn't present in the equivalent page of the NOF project, despite NOF's code being of comparably poorer quality.

  Eric10 18:13 30 Aug 2006

Not being too familiar with the differences between HTML and XHTML I could be wrong but shouldn't your anchor tags have matching closing tags?

  ade.h 18:48 30 Aug 2006

The text above is a bit broken up, due to the forum losing the left-chevrons; however it does validate as XHTML 1.0 Strict. Basically XHTML is not all that fancy, as it's just strict HTML 4.01 made a lot stricter.

  Eric10 19:39 30 Aug 2006

Your code as written above "<p><a href="#anchor1" />Anchor 1</p>" fails in my validator with the following message:

'The "a" tag should be closed by using an end tag (like </a>). It should not be closed by adding a slash to the end of the tag (<a ... /> is not recommended). Note that this may be technically valid according to XML parsers and validators but it may not be technically valid according to the XHTML specification because all elements that are not declared as EMPTY must have an end tag. In any case, it is highly recommended that you use an end tag for backward compatibility. Even newer browser such as Internet Explorer 6.0 may have problems displaying your page correctly if you do not use a separate end tag.'

"<p><a href="#anchor1">Anchor 1</a></p>" however, validates okay.
I use the Lite (free) version of the offline validator downloaded from click here.

  ade.h 19:58 30 Aug 2006

I have what you describe though. Don't go by what you see typed out above as it hasn't come out quite right unfortunately.

  ade.h 23:09 30 Aug 2006

No, like I said, what you see above is not how my code is written as I didn't copy and paste it, but wrote it in the post box, if you see what I mean.

My anchor links are: <p><a href="#anchor1">Anchor 1</a></p>

They validate correctly, but I am still getting the duplicated hyperlink issue. I might just end up getting rid of the anchors and be done with it.

  Sethhaniel 08:36 31 Aug 2006
  ade.h 18:24 31 Aug 2006

They are different words. I'm just using "anchor1" as an example.

The links all work fine and take me to the corresponding paragraph in the text below. It just beats me why the final link is being inherited by the first paragraph (which doesn't have an anchor on it.

I think I'll just remove them as it's not a huge issue really.

Thanks everyone.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

OnePlus 5 review

Alice Saey's mesmerising animation for Dutch singer Mark Lotterman

iPad Pro 10.5in (2017) review

Comment booster votre iPhone ?