CSS Reset: Why You Need It and How to Do It Right
Starting a new project? The first step after git init isn’t creating components, but properly resetting CSS styles. This is the foundation that ensures predictability and cross-browser compatibility for your application.
Every browser (Chrome, Safari, Firefox) has its own set of default styles. <h1> headings in one browser might have different margins than in another. This leads to several problems:
“Resetting styles doesn’t create more work — it saves you from it in the future.”
There are several time-tested strategies for dealing with browser styles. Let’s look at the three most popular ones.
What it does: Completely removes all default browser styles. All elements (h1, p, ul) become visually identical: without margins, font sizes, or other decorations.
Where to get it: The most famous is Eric Meyer’s Reset.css.
How to use it: Link the file in your main CSS or HTML document:
<link rel="stylesheet" href="reset.css">What it does: It doesn’t remove styles but normalizes them. It fixes bugs and makes styles consistent across all browsers while preserving useful defaults (e.g., headings remain large, and lists are bulleted).
Where to get it: Normalize.css on GitHub.
How to use it: It’s included just like any other CSS file.
What it does: This is a set of base styles built on Normalize.css but adapted for a utility-first approach. It resets styles to make working with Tailwind classes as convenient as possible.
How it works: Preflight is part of Tailwind’s base layer and is applied automatically when you include Tailwind in your project. You don’t need to do anything extra.
| Criteria | Reset.css | Normalize.css | Tailwind Preflight |
|---|---|---|---|
| Goal | Complete removal of styles | Making styles consistent | Base for a utility-first approach |
| Style Retention | No, everything from scratch | Yes, preserves useful defaults | Yes, but adapted for classes |
| Best for | Those who want absolute control | Most projects | Projects on Tailwind CSS |
Even if you use one of the methods above, these “lifehacks” are worth adding to every project.
box-sizing: border-box — a must!This code makes the browser count padding and border as part of the element’s width, rather than adding them on top. This saves you headaches during layout.
*,
*::before,
*::after {
box-sizing: border-box;
}body,
h1,
h2,
h3,
h4,
p,
ul,
ol,
li,
figure,
figcaption,
blockquote,
dl,
dd {
margin: 0;
}To prevent images and videos from “breaking” the layout on small screens.
img,
video,
canvas,
svg {
max-width: 100%;
height: auto;
}Forces buttons and input fields to inherit the font from their parent, rather than using a system font.
input,
button,
textarea,
select {
font: inherit;
}Resetting styles is not just good practice; it’s a necessity for creating high-quality, predictable web interfaces.
✅ Start your next project right — with a style reset!