Anchors on other pages scroll above header

I know the header trick for getting anchor links within the same page to scroll down to the bottom of the header.

How can I do this for anchor links on other pages? When I link to an anchor link on another page, it always scrolls to the top of the page, which means the top of the anchor is hidden by my nav bar.