Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8820041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:30:40+00:00 2026-06-14T05:30:40+00:00

I have seen this topic somewhat covered in posts here and here , but

  • 0

I have seen this topic somewhat covered in posts here and here, but they don’t really help me out. The situation is fairly similar though: a scrolling page and a sticky menu bar (fixed div) at the top of the page, with anchor points scattered through the long scrolling text.

Something like this HTML:

<a name="hd1" class="anchor"><h1>Heading Foo</h1></a>
<p>this is some text, and a lot of it
...
<a href="#hd1">jump to Heading Foo</a>
...
<a name="hdx" class="anchor"><h1>Heading Bla</h1></a>
<p>and then there is more text
...
<a href="#hdx">jump to Heading Bla</a>    
...

with some CSS that, for now, is empty because I still just stumble around this issue

.anchor {
  color: green;
} ​

Take a look at this fiddle to see how it works at the moment.

Now, whenever I click on a link it takes me to the anchor. (Yay!) Alas, this also means that the anchor, now at the top of the page, is covered by the sticky menu. (Nay!) It would be great if it would show below the sticky menu.

I’ve tried the solutions that were given in the other posts to no avail. For example, adding padding around the anchor does actually add visible padding in the text and create empty space; which is not what I want. The text ought to appear unmodified visually.

Thanks in advance for hints and tips 🙂

EDIT: I should make it a little more clear. I do not need space on top of the page. I do need every anchor point to be below the menu bar. Try my original fiddle, and click the anchors: you will see how they are positioned so that they are covered by the menu bar.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:30:41+00:00Added an answer on June 14, 2026 at 5:30 am

    Thanks for the input, and I found a working solution based on this discussion. The hint from there was “empty anchors”; on my original fiddle the anchors enclosed the heading and that prevented me from positioning the anchors.

    Changing to empty anchors

    <a name="hdx" class="anchor">&nbsp;</a><h1>Heading Bla</h1>
    

    allows me to move the anchors on the page without affecting any of the (visible) text flow. So the CSS for the anchors now becomes

    .anchor {
      position: relative;
      top: -35px;  /* depending on the size of the sticky menu */
    }
    

    That way, the anchor for a heading is positioned above the heading, and jumping to that anchor causes the heading to show up below the menu bar.

    I’ve updated the fiddle to work correctly. (Two things: the anchors use A1, .. text to show their position but you can empty them. Also, I had to explicitly close the <p> tags to ensure “position:relative” works ok.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen some of the other answers on this topic but dont really
I have seen some posts regarding this topic and a few blogs, but none
I have seen different questions regarding this, but I still find this topic to
I know this topic has been asked, but the posts are all out of
I've seen some other posts in this topic, but thought I would ask the
I have seen other questions asked on this topic, here on SO as well
I have seen a lot of posts on this topic, however I have not
I know there are several other posts on this topic but they still leave
I have seen a number of old posts around this topic on stack overflow
I have seen some of the questions/answers related to this topic here, however still

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.