Foundational element normalization
Foundational element normalization gives document structure and non-text, non-form HTML elements stable browser defaults. It creates a predictable base for the broader reset styles system while leaving typography and form behavior to their focused normalization areas.
Normalization scope
The full reset applies a shared baseline to the document tree. It removes browser spacing, sets a consistent box model, and restores a small set of structural or replaced-element behaviors so later page styles start from known conditions (src/…/global.scss, src/…/other.scss).
The reset has two related forms:
- The full form covers global defaults, text rules, form controls, and other elements through src/index.scss.
- The minimal reset variant keeps only a smaller set of global, heading, list, media, frame, and table defaults.
The typography normalization and form control normalization pages describe the other focused parts of the full reset.
Document defaults
Document defaults establish the base that all descendant elements inherit or use. The root supplies the box model, line height, and system font stack. The universal rule removes default margin and padding and makes descendants use the root box-sizing choice (src/…/global.scss• L1-13).
The reset also keeps basic document structure usable across browsers. main is treated as a block, headings retain a familiar large h1 scale, and adjacent paragraphs gain readable separation without adding spacing to the first paragraph (src/…/global.scss• L15-26).
Box model and spacing
The box model gives every element and pseudo-element a shared sizing basis. Zero default margin and padding prevent browser styles from adding unplanned gaps; page styles can then add spacing for the layout that they define (src/…/global.scss• L1-7).
References: src/…/global.scss• L1-13
Structural element defaults
Structural defaults preserve useful document semantics while removing browser differences. Lists receive an outer margin, nested lists do not accumulate that margin, and horizontal rules keep inherited color with a visible overflow-safe presentation (src/…/other.scss• L1-14).
These rules provide a neutral starting point rather than a complete visual design. The reset does not remove the meaning of list, table, disclosure, or summary elements.
Document structure
Document structure rules keep common block and disclosure elements in their expected layout modes. details remains a block, while summary keeps list-item behavior so the disclosure marker remains available. Table text indentation and border color also follow the surrounding context (src/…/other.scss• L37-65).
References: src/…/other.scss• L37-65
Replaced and embedded elements
Replaced and embedded elements need stable display and visibility rules because browsers do not present them in the same way by default. The reset gives media and canvas an inline-block baseline, removes the old image border, and prevents non-root SVG overflow from changing the page bounds (src/…/other.scss• L20-35, src/…/other.scss• L67-69).
Media without controls stays out of the rendered page. This prevents an audio element that has no user-facing control from leaving an unwanted box (src/…/other.scss• L20-27).
Media and graphics
Media and graphics rules make embedded content fit the surrounding document model without forcing a visual treatment. The minimal reset variant adds responsive sizing for images and video, while the full foundational rules focus on display, border, and overflow defaults (src/…/other.scss• L20-35, src/mini.scss• L22-29).
References: src/…/other.scss• L20-35 src/mini.scss• L22-29
Dialog and hidden content
Dialog and hidden-content rules define whether an element participates in the rendered page. An open dialog receives a usable system-color surface and centered fit-content layout; a closed dialog is not displayed. Templates and hidden elements also remain out of the rendered result, except for the browser's until-found hidden state (src/…/other.scss• L42-77).
This behavior separates content that is present in the document from content that should be visible to the user. It lets native dialog, template, and hidden-state semantics control visibility without depending on browser-specific defaults.
Visibility states
Visibility rules follow the element's native state rather than a shared visual class. The reset hides closed dialogs, templates, and ordinary hidden content, while it preserves the special hidden state used for find-in-page discovery (src/…/other.scss• L42-77).
References: src/…/other.scss• L42-77
Normalization flow
The full reset combines the foundational rules with text and form rules in one ordered stylesheet. This diagram shows how the shared baseline reaches the page before more focused styles are applied.
flowchart LR
A[Browser defaults] --> B[Global document baseline]
B --> C[Foundational element normalization]
C --> D[Typography normalization]
C --> E[Form control normalization]
D --> F[Predictable page starting point]
E --> F
The full entry point loads the global baseline first, then text rules, form rules, and other-element rules. The foundational rules therefore support the whole reset but do not replace the specialized typography normalization or form control normalization behavior (src/index.scss• L1-6).
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the full entry point's order aligned with the boundary between global, text, form, and other-element rules.
- Keep the minimal variant's smaller contract distinct from the full reset when changing shared baseline expectations.
- Check native visibility states when changing rules for
dialog,template, or[hidden]so discoverable hidden content is not hidden by mistake. - Check responsive media behavior separately because the minimal variant owns sizing rules that are not part of the full foundational layer.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A universal spacing or box-model rule changes without a matching root baseline | Descendant sizing and layout gaps vary by browser or by element | Keep the root box-sizing choice and descendant inheritance contract together |
| A closed-dialog or hidden-state selector becomes broader | Native dialog use or find-in-page discovery can fail | Preserve separate closed-dialog and until-found conditions |
| A media display rule is removed | Audio, video, canvas, or SVG can create browser-specific layout or overflow | Review the affected native element states as a group |
Key files
| File | Why to read it |
|---|---|
| src/…/global.scss | Defines the shared document baseline for box sizing, spacing, root defaults, and basic structure. |
| src/…/other.scss | Defines structural, media, graphics, table, dialog, template, and hidden-content defaults. |
| src/index.scss | Shows how the foundational layer joins the full reset with text and form normalization. |
| src/mini.scss | Shows the smaller reset contract for projects that need only core baseline rules. |
| docs/reset-styles.md | Parent page for the overall reset system and its related normalization areas. |