jorendorff / es-spec-html

An HTML version of the ECMAScript draft specification autogenerated from the source
http://ecma-international.org/ecma-262/5.1/
51 stars 17 forks source link

Sticky headings fight with fragment links #73

Closed jorendorff closed 10 years ago

jorendorff commented 10 years ago

Links that point to sections are fine, but consider http://people.mozilla.org/~jorendorff/es6-draft.html#table-1.

In a browser that supports position: sticky (Firefox Nightly for example) the sticky header occludes the figcaption. :-1: I don't know the fix for this, short of JS hackery.

Surely this is a familiar situation to someone. The same problem would affect any page that uses position: fixed to fix elements to the top of the viewport.

claudepache commented 10 years ago

I have found the following nasty trick:

     <style>
    figcaption > span:target {
        display: inline-block;
        padding-top: 2em;
        margin-top: -2em;
    }
     </style>
jorendorff commented 10 years ago

It works like a charm. Thanks, Claude.