So far it also seems to work to just add
:target {
padding-top: 65px; }
to the CSS, so this applies to all elements when they are targeted by an anchor link, and this idea of using a new class "anchor" was not necessary.
It does not seem to change the layout in any way, except for the case when the targeted element is an <a class="back"> "back to the top" link, which has the upward arrow as a background image. The image is then displayed 65 pixels above its usual place when one jumps to it through an anchor link.
So in this case one should maybe remove the anchor id from the "back to top" arrow element and put it inside some normal text part where this problem does not occur. Or maybe somehow one could change the css for the <a class="back"> somehow that it works with the new :target css which would make it all easier and not necessary to change thousands of html files then.
Maybe not the best topic to get lost thinking about much for too long. But just mentioning for the case that someone with more experience in this has an idea.