Skip to content

Commit 6e50ec6

Browse files
committed
docs: add alignment references to CSS rules
Document which CSS reset authors/projects align with each rule: - Josh Comeau, Andy Bell (Piccalilli), Tailwind Preflight - Normalize.css, Modern Normalize (Sindre Sorhus) - Eric Meyer Reset, Elad Shechter (The New CSS Reset) - Keith J. Grant, Jake Lazaroff, Kilian Valkhof - CSS-Tricks, GitHub, Bootstrap 5
1 parent aac7f7a commit 6e50ec6

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

src/elements.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
*
1515
* --font-system-ui-sans: Modern system UI font stack with full emoji support.
1616
* --font-system-ui-mono: Modern monospace font stack for code elements.
17+
*
18+
* Aligned with:
19+
* - CSS-Tricks (Chris Coyier) – System Font Stack article
20+
* - Tailwind Preflight – system-ui based font stack
21+
* - GitHub – uses similar system font stack
22+
* - Bootstrap 5 – native font stack
23+
* - Andy Bell (Piccalilli) – system-ui, sans-serif
1724
*/
1825
:root {
1926
--font-system-ui-sans:
@@ -32,6 +39,11 @@
3239
* - line-height: 1.5 improves readability for body text
3340
* - min-height: 100dvh prevents "short body" issues, enables sticky footers
3441
* - overflow-wrap: break-word prevents horizontal overflow from long words/URLs
42+
*
43+
* Aligned with:
44+
* - line-height: Josh Comeau (1.5), Andy Bell (1.5), Tailwind (1.5)
45+
* - min-height: Josh Comeau (100%), Andy Bell (100%), Modern best practice (100dvh)
46+
* - overflow-wrap: Josh Comeau (break-word on specific elements)
3547
*/
3648
body {
3749
font-family: var(--font-system-ui-sans);
@@ -42,6 +54,10 @@
4254

4355
/**
4456
* ELT-023: Apply monospace font stack to code elements.
57+
*
58+
* Aligned with:
59+
* - Tailwind Preflight – code, kbd, samp, pre { font-family: monospace stack }
60+
* - Normalize.css – code, kbd, samp { font-family: monospace }
4561
*/
4662
code,
4763
pre,
@@ -54,6 +70,10 @@
5470
* ELT-010: Minor link improvements while keeping them recognizable.
5571
* text-decoration-skip-ink improves readability of underlines
5672
* by avoiding crossing descenders (g, j, p, q, y).
73+
*
74+
* Aligned with:
75+
* - Andy Bell (Piccalilli) – a { text-decoration-skip-ink: auto }
76+
* - Modern browser default (but explicit is better)
5777
*/
5878
a {
5979
text-decoration-skip-ink: auto;
@@ -69,5 +89,9 @@
6989
*
7090
* ELT-030, ELT-031: No fluid typography, scales, or clamp()-based
7191
* font sizing in v1. Only default UA behavior + base font family.
92+
*
93+
* Intentionally NOT included (contrary to some resets):
94+
* - Elad Shechter removes list-style completely
95+
* - Some resets add heading margins back
7296
*/
7397
}

src/fixes.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,28 @@
1919
* - https://developer.mozilla.org/en-US/docs/Web/CSS/text-size-adjust
2020
* - https://kilianvalkhof.com/2022/css-html/your-css-reset-needs-text-size-adjust-probably/
2121
* - https://webkit.org/blog/57/css3-text-size-adjust/
22+
*
23+
* Aligned with:
24+
* - Normalize.css – html { -webkit-text-size-adjust: 100% }
25+
* - Modern Normalize (Sindre Sorhus) – text-size-adjust: 100%
26+
* - Kilian Valkhof (CSS-Tricks article) – explicit recommendation
2227
*/
2328
html {
2429
-webkit-text-size-adjust: 100%;
2530
text-size-adjust: 100%;
31+
2632
/**
2733
* Normalize tab character width in <pre> elements.
2834
* Browsers default to 8 spaces which is excessively wide.
2935
*
3036
* References:
3137
* - https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size
38+
*
39+
* Aligned with:
40+
* - Normalize.css – html { tab-size: 4 }
41+
* - Modern Normalize (Sindre Sorhus) – tab-size: 4
42+
* - Tailwind Preflight – tab-size: 4
43+
* (We use 2 for more compact code display)
3244
*/
3345
-moz-tab-size: 2;
3446
tab-size: 2;
@@ -47,6 +59,11 @@
4759
* - https://www.smashingmagazine.com/2021/10/respecting-users-motion-preferences/
4860
* - https://web.dev/prefers-reduced-motion/
4961
*
62+
* Aligned with:
63+
* - Josh Comeau – @media (prefers-reduced-motion: reduce) handling
64+
* - Andy Bell (Piccalilli) – more aggressive (animation/transition-duration: 0.01ms)
65+
* - Jake Lazaroff – scroll-behavior: auto
66+
*
5067
* UFX-022: Additional reductions (animation-duration, transition-duration)
5168
* are intentionally omitted in v1 to avoid breaking intentional animations.
5269
* Implementers should handle these in their own stylesheets as needed.

src/reset.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
*
1515
* Note: We use a direct approach rather than inheritance (RST-021, RST-023)
1616
* to ensure compatibility with Web Components and slotted content (WC-003).
17+
*
18+
* Aligned with:
19+
* - Andy Bell (Piccalilli) – margin: 0 on *, box-sizing: border-box
20+
* - Tailwind Preflight – margin: 0, box-sizing: border-box
21+
* - Elad Shechter (The New CSS Reset) – via all: unset approach
22+
* - Eric Meyer Reset – margin: 0, padding: 0
23+
* - Josh Comeau – box-sizing: border-box (margin only on body)
1724
*/
1825
*,
1926
*::before,
@@ -32,6 +39,12 @@
3239
* RST-031: Media elements get block display with responsive sizing.
3340
* This prevents unwanted whitespace below inline images and ensures
3441
* media elements don't overflow their containers.
42+
*
43+
* Aligned with:
44+
* - Josh Comeau – img, picture, video, canvas, svg { display: block; max-width: 100% }
45+
* - Andy Bell (Piccalilli) – img, picture { display: block; max-width: 100% }
46+
* - Tailwind Preflight – img, video { display: block; max-width: 100% }
47+
* - Keith J. Grant – img { max-width: 100% }
3548
*/
3649
img,
3750
picture,
@@ -46,6 +59,12 @@
4659
/**
4760
* RST-040: Form elements inherit font from their parent.
4861
* This ensures consistent typography across form controls.
62+
*
63+
* Aligned with:
64+
* - Josh Comeau – input, button, textarea, select { font: inherit }
65+
* - Andy Bell (Piccalilli) – input, button, textarea, select { font: inherit }
66+
* - Tailwind Preflight – button, input, select, textarea { font-family/size/line-height: inherit }
67+
* - Normalize.css – partial (font-family: inherit on button/input)
4968
*/
5069
button,
5170
input,
@@ -58,11 +77,21 @@
5877
* RST-041: Focus indicators are NOT removed (no global outline: none).
5978
* RST-042: cursor: pointer is NOT set globally.
6079
* These are intentionally omitted to preserve accessibility defaults.
80+
*
81+
* Aligned with:
82+
* - Josh Comeau – explicitly does NOT remove outlines
83+
* - Andy Bell (Piccalilli) – explicitly does NOT remove outlines
84+
* - WCAG accessibility guidelines
6185
*/
6286

6387
/**
6488
* Normalize table border behavior.
6589
* UA defaults for border-collapse vary; this ensures consistent table rendering.
90+
*
91+
* Aligned with:
92+
* - Andy Bell (Piccalilli) – table { border-collapse: collapse }
93+
* - Tailwind Preflight – table { border-collapse: collapse }
94+
* - Eric Meyer Reset – table { border-collapse: collapse; border-spacing: 0 }
6695
*/
6796
table {
6897
border-collapse: collapse;

0 commit comments

Comments
 (0)