Fixing full fixed

    An article by Shitov (Lebedev Studio) describes a fully working fixed.
    My hands reached the creation of such a fixed one and decided to use the proposed solution.
    But it did not work. I began to study the source code of the article (well, it works there) and eventually found out that the matter was in DOCTYPE. As you know Lebedev put it on him, but I wrote it. He turned off fixed in IE.

    1st option Back to quirks

    If you specify doctype, then the whole concept flies in tartarara. It is quite easy to make the code valid, and everything works (after 2 hours of foreign Google) - you need
    to put an empty HTML comment before the doctype. At the same time:
    1. The w3c validator says that the code is correct.
    2. Ognennolis recognizes doctype and works in accordance with it.
    3. IE is stupid - it does not find the doctype on the first line and goes into compatibility mode. Fixed works.
    4 Opera on the computer is not worth it - I will not say anything.

    2nd option Forward to DOCTYPEs

    Why is this happening?
    Everything is as usual very simple. Shitov uses document.body.scrollTop ; as, by the way, most Internet users, insofar as Yandex used to give me only this wording in its time (in the same way, JS programmers teach on the Internet, here's what can be said about essentially following the w3c standard without going into philosophical aspects )
    And in IE compliance mode, the object model changes and you need to usedocument.documentElement.scrollTop .
    The h1 code is indeed on top, but now only with DOCTYPE
    padding:5em 0 0 0;

    Also popular now: