CSS
CSS is a funny little styling language because it is a “standard” that is interpreted at the whims of the browsers. What this means is that you are going to have to contend with how (mainly) Chrome, Firefox, & Safari / all iOS browsers’ quirks and decisions. Ideally you also want the end result to still be readable by a tui browser like lynx which offers a good basic test for how accessible your page is for those with screen readers or javascript disabled.
CSS Quickref
:root {
--var: value; /* create variables to reference the same value multiple times */
color-scheme: dark light; /* tells the browser that you are using a dark color scheme, but have a light mode available (see the media query below) */
}
@media (prefers-color-scheme: light) {} /* applies rules to users who have forced light mode via their browser */
h1, a{} /* applies to both h1 AND a tags */
h1 a{} /* applies only to `a` tags within h1 tags */
/* this allows you to highlight links differently if they are web links vs internal */
a[href*='//']{}
a{}
h1:has(a){
/* this is a modifier that will only apply to h1 tags that contain an `a` tag, while ignoring other ones */
}
h1 {
& a {
/* another way to write h1 a {}, useful if you have a lot of elements within one parent element that need unique rules */
}
}
@media screen and (orientation: portrait), (max-width: 600px){} /* this will filter for screens that are either portrait OR have a width > 600px */