css notes
i made a lot of bad websites before. nowadays i don't really do anything silly.
Table of Contents
making my site printable
when the user prints a page to paper or pdf, i strip the navigation and footer links:
@media print { nav, .status { display: none } pre { overflow: visible; } }
inline css? maybe a little.
you can download any page on this site with a tool like wget. each page has a bit of inline css:
body, .string, .comment {font-family: "Iosevka"} code, pre {font-family: "IBM Plex Mono"} body { max-width: 50em; margin: auto; } hr { border: 2px solid #EEEEEE; } html { padding: 3%; } pre { overflow: auto; } a:hover { color: #338800; } pre { border-left: 3px solid #000000; padding-left: 20px; }
idk if i want it to be like this, or if i should let users define their own.
cli-viewable
auto dark/light themes
in my style.css file, i link to dark.css if the user's machine has a light-mode preference:
/* load theme based on system preference */ @import url("/dark.css") (prefers-color-scheme: dark); @import url("/light.css") (prefers-color-scheme: light);
i use variables to store color names, to make creating new color themes easy. for example, light.css looks like this:
/* light.css * dark.css looks just like this with * different colors. */ :root { --bg: #FFFFFF; --fg: #222222; --bg-dim: #DDDDDD; --fg-dim: #888888; --bold: #000000; --h1: #222222; --link: #0000BB; --link-hov: #448800; }
color variables
the rest of style.css just uses these color variables and applies them throuought the site:
body { background: var(--bg); color: var(--text); } pre { background: var(--bg); color: var(--bold); } /* ... */
so far that's it, i guess :3