Search code examples
htmlanchor

How Github Link Anchor Works


Both links with following anchor-ed a tags:

<a id="user-content-cd" class="anchor" aria-hidden="true" href="#cd"></a>

Why Github works with #cd (Jump to H2 of cd section): https://github.com/mitnk/cicada/blob/master/docs/builtins.md#cd

But this one does not work: https://hugo.wang/cicada/builtins.md#cd

??


Solution

  • <a href="#cd">...</a> links to an element with id="cd".

    You need to have a matching element to link to.