• Resolved tyco72

    (@tyco72)


    Hello, I have assigned the category “anchor” to the ID that I enter into the HTML tags where the destination for anchor links is located. Example

    <p id=”jump” class=”anchor”>anchor link1</p>

    and then I should use this CSS code:

    .anchor {
    scroll-margin-top: 60px;
    }

    It is to scroll the page of a little space, when the screen points to the destination of an anchor link. Since the menu bar is set as sticky, the destination row of the anchor link is covered by the menu. You can see it here:
    https://www.tycospages.com/section-5/

    The problem is that the command “scroll-margin-top” seems to be wrong. It is shown with red color and doesn’t work. I have not found similar commands with “scroll”. Which is the right command?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    This has a few solutions which are worth checking out: https://stackoverflow.com/questions/10732690/offsetting-an-html-anchor-to-adjust-for-fixed-header

    Thread Starter tyco72

    (@tyco72)

    Hi Tom, thank you!
    I have tried the most easy of these solution. I have found only one which works partially :

    .anchor::before {
    content:””;
    display:block;
    height:65px; /* fixed header height*/
    margin:-65px 0 0; /* negative fixed header height */
    }

    Strangely, it works on the old Internet Explorer (V11), but not on Firefox 18
    On this PC the main browser is Firefox. IE is only a reminiscence. Tomorrow I will try with Chrome on another PC.
    Have you idea why it doesn’t work on Firefox?

    Theme Author Tom

    (@edge22)

    Hmm, it definitely should, especially if it’s working on IE11.

    Thread Starter tyco72

    (@tyco72)

    Hi Tom, yes, you are right. I was logged in, in my Firefox, and the row was covered because of the presence of the additional login topbar… I thought that WordPress counted its bar automatically. But great! Now I can work much better with the anchor links!

    • This reply was modified 4 years, 7 months ago by tyco72.
    Theme Author Tom

    (@edge22)

    Awesome, great to hear ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘command to scroll the screen a little, for anchor links’ is closed to new replies.