Re: #top anchor doesn't work in FF



Well bust mah britches and call me cheeky, on Wed, 31 Oct 2007 12:24:14
GMT Harlan Messinger scribed:

Bernhard Sturm wrote:

Hi Group,
We are currently testing a site: http://wwwt.ichschweiz.admin.ch/
which has a 'top of page' navigation at the bottom of each page
(pointing to an anchor at the top of the html-structure).
The problem is, that this 'top of page'-navigation doesn't seem to
work with Firefox (2.0.0.9 / Windows XP). IE has no problem with the
link. I am sure I made something wrong, but I can't figure out where
I missed the right turn. Could some of you have a look at it, and
tell me where I missed it?

You have a div with id="top" and an anchor with name="top". This is
incorrect HTML:

http://www.w3.org/TR/html4/struct/links.html#anchors-with-id

Firefox sees two different elements that could be the destination for
the link and therefore can't react to it. (The fact that they are
nested or adjacent is irrelevant.) IE probably handles the flawed code
by ignoring the A tag because by that point it has already registered
the DIV tag as the "top" element.

The solution is to take the ID off the DIV and stick it in the anchor:

<div><a id="top" name="top"></a></div>

Yes, and there's also something with the css/javascript display:none; on
the current "top" div. When I change things to:

<div id="top" style="display:block"><a name="tp" id="tp"></a></div>

and

<div id="gotop"><a href="#tp" title="zum seitenanfang">zum seitenanfang
</a></div>

....it works.

--
Neredbojias
Just a boogar in the proboscis of life.
.



Relevant Pages

  • Re: CSS-positioning with top and bottom
    ... I tried it and the surprising result is, that wrapping the image in the div ... leads to the intended behaviour in Firefox and Opera but not in IE: ... the height of an object by setting values for top and bottom works, ... only in Firefox, I'm now going to replace the img tag with a div tag, that ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: #top anchor doesnt work in FF
    ... We are currently testing a site: http://wwwt.ichschweiz.admin.ch/ which has a 'top of page' navigation at the bottom of each page (pointing to an anchor at the top of the html-structure). ... Firefox sees two different elements that could be the destination for the link and therefore can't react to it. ... IE probably handles the flawed code by ignoring the A tag because by that point it has already registered the DIV tag as the "top" element. ...
    (alt.html)
  • Re: Float:right in position: absolute messed up in firefox
    ... I have a small problem with some weird behavior of Firefox. ... I have a div that's positioned absolutely on ... The two arrows are positioned using floats left and ... child element to float left actually floats it as far left as possible. ...
    (alt.html)
  • Float:right in position: absolute messed up in firefox
    ... I have a small problem with some weird behavior of Firefox. ... I have a div that's positioned absolutely on ... The two arrows are positioned using floats left and ... and under it is a table that shows the actual calendar. ...
    (alt.html)
  • Re: Can a divs width expand to fit contents width?
    ... Most of those don't work in IE and inline-block doesn't in Firefox 2. ... colour provide the drop-shadow and then offsetting a div within the ... Can you see any way to tweak the code in my mock-up at http://tinyurl.com/6kvjtn ...
    (comp.infosystems.www.authoring.stylesheets)