Home > database >  How do I make a link jump to the correct part of another page?
How do I make a link jump to the correct part of another page?

Time:03-14

I've made a link to jump to a part of another page using the following HTML:

<a href="./about-us.html#our-mission"> Read more &#187;</a>

This is the id of the link where it goes to:

<div id="our-mission" name="our-mission">

The problem is that it is dropping me a few lines down from the heading "Our Mission" on the targeted page.

How do I get it to target the correct spot, please? Tnx.

CodePudding user response:

I guess you need to set an offset. You sould try something like this:

https://css-tricks.com/hash-tag-links-padding/

offsetting an html anchor to adjust for fixed header

CodePudding user response:

Try adding this to your CSS file:

    #our-mission {padding-top:3%;}

Adjust percentage as needed.

  • Related