Site logo

Archived topic

Anchor link doesnt target the top of the container ?

7 replies · Started by Christophe on January 16, 2022

Viewing posts 1–8 of 8

Hi,

I used several anchor link but i sttruggle to make them aim the top of a container.
Is it cause of margin/padding ?

Can you tell me how i'm supposed to make it aim the top of a container ?
On this page its bring to the middle of the container... not very clean. :)
http://skravik.alambic.bzh/nos-activites/#activites

Cheers,
C.

I use this css cause i use your theme, i dont think i added this piece of css myself ;)

I'll check what you suggest tonight and give you some feedback.
Thanks Leo !

[EDIT] Actually the piece of css was give to me by your support: https://generatepress.com/forums/topic/sticky-header-12/
Does your suggestion to use the navigation as header involve removing the piece of CSS to make the navigation sticky ?

Hi there,

the original example provided in the other topic had a more complicated header which is why CSS was provided.
Instead you can:

a) remove the CSS provided.
b) in Customizer > Layout > Header enable the Navigation as Header.
c) enable the Sticky Navigation in Customizer > Layout > Sticky Nav
d) enable the Smooth Scroll in Customizer > General and see here how to apply to your links:

https://docs.generatepress.com/article/smooth-scroll/

The GP Sticky Nav with the Smooth Scroll will offset the height of the sticky nav when that link is jumped to.

Hi, thanks for your detailed answer.

I activated the Navigation as a Header and then the Sticky Nav.
The links to the anchors work better.
But with the Navigation as a header the logo image doesnt show up properly, the height of the menu seems to be the problem now:
http://skravik.alambic.bzh/nous-contacter

You can adjust the menu item height at customizer > layout > primary navigation > menu item height.

Let me know if this helps :)

Ying: Thanks for the obvious solution... Did not explore all menus enough yet.
Will come :)

You are welcome :)

This archived topic is closed to new replies.