Skip to content

Instantly share code, notes, and snippets.

View dragontheory's full-sized avatar
Could tell you, but then I'd have to, well . . . you know.

D7460N dragontheory

Could tell you, but then I'd have to, well . . . you know.
View GitHub Profile
@dragontheory
dragontheory / harnessing-container-queries-for-modular-design.md
Last active January 19, 2026 20:31
Harnessing Container Queries for Modular Design

Image

Quick, practical intro to CSS container queries - a way to make components adapt to their own container size (context), not the viewport. This is a big shift from media queries!

<!-- Minimal, attribute-free structure -->
<card>
  <h2>Title</h2>
  <p>Content…</p>
</card>
@dragontheory
dragontheory / css-state-system-without-js-frameworks.md
Last active January 19, 2026 21:17
CSS State Systems without JS Frameworks

Image

Quick practical upgrade pack for truly declarative, JS‑free UI logic using modern CSS: :target, :has(), and container style queries.


:target — URL‑driven toggles (no JS)

Use hash links (#id) to open/close sections, focus cards, or reveal details. It’s native, accessible, and back/forward‑button friendly.

@dragontheory
dragontheory / pure-css-modals-that-fade-gracefully.md
Created January 19, 2026 17:26
Pure CSS Modals That Fade Gracefully

Image

Tiny, scoped, JS‑free modal pattern that can drop in: it uses <dialog> with :modal, styles its ::backdrop, and animates open/close with @starting-style + transition-behavior: allow-discrete;. State is declarative via a hidden checkbox, but you can swap to :target if you prefer.

<new-modal>
  <!-- state (declarative) -->
  <input type="checkbox" hidden aria-hidden="true">

  <!-- open trigger (anywhere in your UI) -->
@dragontheory
dragontheory / font-rendering.md
Created January 19, 2026 17:19
Font rendering: clarity & perf tips

Image

🔤 Modern CSS Font Rendering — clarity & performance (practical notes)

1) text-shadow: clarity vs cost

  • Use sparingly. Even a subtle shadow forces extra paint work; animated or large-blur shadows can trigger repaints every frame.
  • Prefer small offsets + zero/low blur for contrast on light text.
  • Avoid stacking multiple shadows on long passages; reserve for headings or UI labels.
@dragontheory
dragontheory / html-css-patterns-that-replace-js.md
Last active January 19, 2026 17:18
Modern HTML + CSS patterns that replace or drastically reduce traditional JavaScript UI behavior.

Image

Modern HTML + CSS patterns that replace or drastically reduce traditional JavaScript UI behavior. Each example is progressive, accessible, minimal, and declarative.


1) Toggle / Accordion → <details> + <summary>

Replaces: JS click handlers, state variables

@dragontheory
dragontheory / Intrinsic-responsive-CSS-patterns.md
Created January 19, 2026 17:14
Intrinsic responsive CSS patterns.

Image

CSS‑only intrinsic responsive layout patterns that let UI components wrap or adapt based on available spacenot arbitrary hardcoded breakpoints. These rely on container queries, style queries, and native CSS layout mechanics. All examples are practical, drop‑in ready, and viewport‑independent.


1) Adaptive Component Layout with Container Queries

Use: let a card flip between column/row based on container width. Why: layout responds to container size, not viewport. ([MDN][1])

@dragontheory
dragontheory / Drop‑in-CSS-scrollbars-on-hover.md
Created January 19, 2026 15:00
Drop‑in CSS snippets that hide scrollbars by default and show them on hover, suitable to integrate with design/theme tokens (e.g., CSS custom properties).

Image

Short, practical drop‑in CSS snippets that hide scrollbars by default and show them on hover, suitable to integrate with design/theme tokens (e.g., CSS custom properties). Useful patterns leverage standard CSS Scrollbars Module + fallback WebKit pseudo‑elements. Authoritative specs/tools cited. ([MDN Web Docs][1])


1) Modern + fallback: show scrollbars on hover

/* theme tokens */
@dragontheory
dragontheory / Scalable-fluid-border‑radius.md
Created January 19, 2026 14:56
Scalable fluid border‑radius

Image

A drop‑in, scalable border‑radius system that harmonizes with fluid typography using CSS clamp() — minimal, practical, and responsive.


Why this works

  • Fluid typography: scales between a min & max viewport width.
  • Fluid radii: scales the corner rounding in proportion to type size.
@dragontheory
dragontheory / SharePoint-SPA-Baseline.md
Created January 19, 2026 14:53
Baseline** for SPA‑enabling SharePoint 2016 SE without introducing upgrade or governance debt.

Image

Automation Turn #6 — Best‑Practice Blueprint: SPA‑Enabling SharePoint 2016 SE (No Regression)

Scope: Introduce a Single‑Page Application (SPA) layer on a SharePoint 2016 SE site while preserving all existing content, navigation, permissions, and URLs. Constraint: SharePoint remains the source of truth; SPA is additive and removable.


1) Architectural Patterns (What Actually Survives Operations)

@dragontheory
dragontheory / Modern-CSS-resets-Minimal-picks.md
Created January 19, 2026 14:50
Modern CSS resets - Minimal picks

Image

Below are short, practical CSS reset snippets focused on modern browsers — minimal, accessible, and grounded in current best‑practice guidance. Each has a succinct explanation and a reference to authoritative discussion or source.


🔹 1. Andy Bell’s Modern Reset — clean, practical baseline

/* Box sizing */