Previous Message
Next Message

Re: [css-d] Anchors vanishing under fixed DIV at top of page

Sent by Craig Saila on 31 January 2002 12:12

Philip King wrote:

> Under the nav bar I have a list of HREFs which link to name anchors
> further down the page. When the link is invoked, the text of the name
> anchor is hidden beneath the navigation bar.

Ran into this exact problem myself a little while ago, here's my sort-of 

A[name] { position: relative; top: -63px }

This basically pushes any anchor with a name attribute up 63 px. This 
only worked in Mozilla/Netscape 6 if the anchor was not surrounding text 
(i.e., empty). Doesn't work in Opera or IE5/Mac, both of which support 
position fixed.

Had to rely on some ugly JS (called at the end of the page) to correct 
anchors surrounding text:
   if(agt.indexOf('gecko') != -1){
     var aName = d.anchors;
     for(x = 0; x < aName.length; x++){
       if(aName[x].text.length > 1){
        d.write('<style>A[name="'+aName[x].name+'"]' +
        '\{ position: relative; top: 0; \}<\/style>')

Love to hear a better way...


Craig Saila

Do You Yahoo!?
Get your free address at
Previous Message
Next Message

Possibly related: