I am using anchor links in the Front Page of this Website.


In order for the anchor links to land in the right place, below the menu upper bar, is to use a 50px division. Nevertheless, the spaces between the title and the upper element are uneven; for example, the space over ACCUEIL is greater the space over SPORTIVES. If you navigate through the anchors, you will see the difference.

¿Any JavaScript technique to accomplish the offset without the need to use the css divisions, and therefore have more control with the inter element distances?


  • 1
    seems to be working fine (same amount of pixels from the nav menu) on Chrome/OSX – user2015 Jun 28 '18 at 17:48
  • Looks the same to me too. – Jacob Peattie Jun 29 '18 at 7:16
  • Be very careful trying to force things to exact pixels. If any of your visitors is using a custom user stylesheet (i.e. enlarging the font on every site so they can read it) your layout will break. Also different browsers handle partial-pixel rounding differently so some browsers may end up 1 pixel off, looking odd. Far better to do your layouts with ems, rems, percentages, etc. that flex, so they're not fragile. – WebElaine Jun 29 '18 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.