from Hacker News

A CSS Snippet That Makes Any HTML Page Look Good

by lowmemcpu on 7/17/20, 8:49 PM with 3 comments

  • by 1f60c on 7/17/20, 9:04 PM

    Very nice. For those of us who'd appreciate a live demo (like me), I wrote this script:

      document.querySelectorAll('link[rel="stylesheet"], style').forEach((style) => style.remove());
      
      const style = document.createElement("style");
      style.appendChild(document.createTextNode("body{font-family:sans-serif;line-height:140%;max-width:38rem;padding:2rem;margin:auto}h1,h2,h3,h4,h5{margin-bottom:.6rem;line-height:120%}p{margin:0 0 1rem}"));
      
      document.head.appendChild(style);
  • by Geffrey on 7/18/20, 7:57 AM

    Hi! Geffrey from … geffrey.io here. Thanks for posting!

    That website is a bit wonky, sorry for that.

    Thanks again!