css
A properly-written web page is readable sans CSS.
arachne
Here are the unminified and annotated stylesheets I use for this site.
Warning: might contain some idiosyncratic choices.
- core: contains variables and styles shared across all page types
- home: styles for the homepage
- page: styles for “default” pages—project pages, journal pages
- year: styles for the yearbook pages; see 2025
Note: Some pages have inline <style> for page-specific styling.
alternate styles
It’s possible to have alternate stylesheets in a webpage:
<link rel="stylesheet" href="main.css" title="default">
<link rel="alternate stylesheet" href="alt.css" title="alternate">selectors
Selector for external links:
a[href^="http"]feature queries
You can use @supports to conditionally apply rules and integrate features based on browser support.
@supports (grid-template-rows: masonry){
.gallery { grid-template: masonry / 5fr 5fr }
}media queries
This isn’t definitive and certain scenarios may call for more specific screen size values but generally this is what I go with:
/* mobile */
@media screen and (min-width: 30em) {
/* tablet */
}
@media screen and (min-width: 60em) {
/* desktop */
}There are also queries for media features to check if the browser prefers reduced motion, if interaction is via touch or cursor, if orientation is landscape or portrait, etc. I created a tool in the lab so you can check what your browser is set to.
@media (hover: hover) and (pointer: fine) {
/* if browser uses cursors instead of touchscreen for interaction */
}
@media (prefers-color-scheme:dark) {
/* dark mode styles */
}fancy footnotes
You can use the symbols() function to override counter styles in lists. I use this to make fancy footnotes.
ol#footnotes {
list-style: symbols(symbolic "*" "†" "‡" "§" "‖" "¶");
}- a footnote
- another footnote
- three footnotes
- four feetnotes
- five feetnoteses
- six feetnoti
- seven feetnote
minifier
I use lightningcss for minification.
pnpm i -g lightningcss
lightningcss -m in.css -o out.cssframeworks
I dislike them in general. They introduce unnecessary learning curves to the glorious simplicity of vanilla CSS and, more often than not, can be quite constrained, making full customisation a hurdle. But if I must recommend some, these are the ones I consider decent*:
resources
- A (more) Modern CSS Reset by
()Andy Bell - CSS tips by Thomasorus ()
- Naming Variables in CSS by
()Jonathan Dallas