1. 27
  1. 10

    Sadly, it doesn’t work in combination with my favourite Firefox trick: putting stylesheets in HTTP Link headers. Why do that? because you can style non-html content, like so:

    nc -l 8080 <<EOF
    HTTP/1.1 200 Meh, it's OK, I guess
    content-type: text/plain
    link: <https://unpkg.com/sakura.css@1.2.0/css/sakura-dark.css>; rel="stylesheet"
    hello, world!
    1. 3

      I didn’t knew you could do that…

      1. 1

        Does that work for other browsers? Is this a way to syntax highlight without HTML?

        1. 1

          (sorry for the late reply, i’m not usually logged in and only look at the front page)

          the blog post i read about this mentioned that the old opera (w/ presto engine) supported this as well. there are open bugs for webkit and blink, but neither are interested.

          when you open a plain text document with firefox, it gets wrapped in a <pre> element, so that’s the only tag you get to interact with. css doesn’t have a feature to access individual words/characters (with the exception of :first-letter and :first-line), so that doesn’t (sadly) work. but you can at least give it some sensible margins, text size and a dark theme ;)

      2. 7

        They are usable from JavaScript for some (commonplace) browsers that don’t support it. The demo page of highlight.js has been using alternate stylesheets to switch themes since… always.

        1. 7

          As a firefox user, I had no idea that the alternate styles came from the site itself! I’m also surprised that FF still supports this feature. I might add this to my site just for fun.

          1. 3

            That’s the spirit. I decided to post this because it is a feature that has been there since forever and I noticed most people don’t know about it. It is quite fun. I can see people who are better with CSS than I am doing some crazy stuff, CSS Zen Garden style, with this feature. Even if only for fun.

          2. 9

            This is cool, but let’s keep quiet about it to preserve it!

            If Firefox devs see this it will get removed, because Chrome doesn’t do it.

            1. 5

              On my website I’ve had alternative style sheet for years, but this feature is really half baked because Firefox doesn’t remember your choice and like with most useful stuff you can put on your website (feeds…) makes absolutely no effort to notify visitors of their existence.