### code, alap ### a[name] { padding-top: 75px; margin-top: -75px; display: inline-block; /* required for webkit browsers */ vertical-align: top; } ### code, 2022.01. ### :target::before { content: ""; display: block; height: 160px; /* fixed header height*/ margin: -160px 0 0; /* negative fixed header height */ } ### code, 2022.01. B (mobil vs. asztali) ### @media screen and (min-width: 768px) { :target::before { content: ""; display: block; height: 160px; /* fixed header height*/ margin: -160px 0 0; /* negative fixed header height */ } } @media screen and (max-width: 767px) { :target::before { content: ""; display: block; height: 250px; /* fixed header height*/ margin: -250px 0 0; /* negative fixed header height */ } } SOURCE: https://stackoverflow.com/questions/4086107/fixed-page-header-overlaps-in-page-anchors