Reset and normalization
Definition and purpose
A reset deliberately replaces selected browser defaults; normalization aims to make useful defaults more consistent across browsers. Choose a documented baseline rather than removing every default.
Predictable sizing
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> body { margin: 0; font: 16px sans-serif; color: #172033; background: white; } :where(*), :where(*)::before, :where(*)::after { box-sizing: border-box; } #a { width: 100px; padding: 10px; } </style> </head> <body> <div id="a">Sample</div> </body></html>Padding stays inside the specified width.
Syntax and mental model
A low-specificity reset using :where() and separate :where()::before and :where(*)::after selectors can establish border-box sizing. Keep pseudo-elements outside :where(); pseudo-elements add type specificity. Target margins on specific headings and paragraphs where needed. Form controls can inherit font while preserving native appearance and focus. Retain list markers, keyboard outlines and semantic structure unless a replacement is intentional. Test the result with user preferences and multiple browsers.
Preserve list semantics
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> body { margin: 0; font: 16px sans-serif; color: #172033; background: white; } :where(ul) { margin-block: 0; } :where(button) { font: inherit; } </style> </head> <body> <ul id="a"> <li>First</li> <li>Second</li> </ul> <button id="b">Save</button> </body></html>The list keeps its markers and the button inherits the font size.
Common mistakes
Avoid a universal margin, padding and outline reset without auditing the consequences. A reset is not a guarantee of pixel-identical rendering.
Practice and next steps
After trying the examples, complete the linked coding exercise and review questions. Predict the result before running your code. Prerequisite: Semantic tokens and themes, Animation and transition precedence, International component project. Next lesson: Naming and component boundaries.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Reset and normalization — knowledge check
Five questions on reset and normalization.
What is a targeted reset?
What is normalization aimed at?
What specificity does :where() contribute?
Why keep focus outlines?
What width results from border-box width 120px and padding 12px?