border-radius shorthand, complete

border-radius: 1px 2px 3px 4px / 5px 6px 7px 8px; is the same as border-top-left-radius: 1px / 5px; border-top-right-radius: 2px / 6px; border-bottom-right-radius: 3px / 7px; border-bottom-left-radius: 4px / 8px; The order is border-top-left-radius x border-top-right-radius x border-bottom-right-radius x border-bottom-left-radius x / border-top-left-radius y border-top-right-radius y border-bottom-right-radius y border-bottom-left-radius y ;

using has to select siblings

has(> .pink):hover > *:not(:hover) { background: white; } parent of pink, hover any, others change :has(> .pink) > *:not(.pink) { background: white; }
siblings of pink get white bg: parent of pink all children except pink white bg
Category: CSS

light and dark theme support

html

<select name="theme" id="theme"> <option value="system">System</option> <option value="brightlight">Light</option> <option value="darknight">Dark</option> </select>

css

:root { --theme: brightlight; color-scheme: light; } @media (prefers-color-scheme: dark) { --theme: darknight; color-scheme: dark; } :root:has([value="brightlight"]:checked) { --theme: brightlight; color-scheme: light;} :root:has([value="darknight"]:checked) { --theme: darknight; color-scheme: dark; } body { background: hsl(0 0% 90%); color: hsl(0 0% 15%); h1, h2: hsl(0 0%…
Category: CSS

kbd and samp styling

any kbd that does NOT contain another kbd or a samp kbd:not(:has(kbd, samp)) { color: midnightblue; background: aliceblue; border-radius: 4px; padding-inline: 4px; box-shadow: 2px 2px 0 3px Lightsteelblue; margin-inline-end: .25ch; } for system menus, messages, and outputs samp { padding: 1rem; border: 1px solid currentColor; background: hsl(from currentColor h s l / 0.1); } <samp>To…

turquoise colors

things that don't need JavaScript

custom switches <label> <input type="checkbox" /> do that thing </label> appearance: none; hey, browser, leave this alone reactivates input::before input { appearance: none; position: relative; display: inline-block; background: lightgrey; height:1.65rem; width:2.75rem; vertical-align:middle; border-radius:2rem; box-shadow:0px 1px 3px #0003 inset; transition: 0.25s linear background; } input::before { content: ''; display:block; width:1.25rem; height:1.25rem; background: #fff; border-radius:1.2rem; position: absolute;…
azurelightcyan
paleturquoise
mediumturquoiseturquoise
cadetbluecyan