Elements that have an id
attribute can be linked to via an URL with a fragment, as you probably know. However, there is an issue if the web page has a position: fixed
sticky header: The browser does not take the header into account when setting the scroll position, and as a result, the top portion of the linked element (usually the element’s heading) is concealed by the sticky header.
Demo: http://exploringjs.com/es6/ch_callables.html#_cheat-sheet-callable-entities
I’m sure you’ve all experienced this issue before; I think it’s relatively common. How should we approach fixing this issue? A browser intervention? Maybe browsers could make sure that position: sticky
elements never conceal fragment-linked elements. (This could also be defined in the appropriate CSS spec.) Then websites could start using sticky
for their sticky headers as a best practice.