Hacker News new | ask | show | jobs
by joegibbs 2040 days ago
It does it by this CSS:

    main > * {
        display: none;
    }

    main > *:last-child {
        display: block;
    }

    main > *:target {
        display: block;
    }

    main > *:target ~ * {
        display: none;
    }
Which hides all children of the <main> element except the last element, which is the default page. Then when an element is targeted by its ID it's displayed, otherwise it's hidden.

It saves that into a CSS file and injects that into the <head>.