sanitize.css is a CSS library that corrects broken and missing styles in all browsers, preserving useful defaults rather than unstyling everything. It’s developed alongside normalize.css, so every normalization includes the browsers or browser versions being targeted, and every opinionated change is marked and documented.


npm install sanitize.css

Use with CSS

@import url(sanitize.css);

Use with a CDN


View GitHub Download 7.0.2

Why another CSS base?

I’m sharing this because I need these styles all too often, and maybe you do too.

I started writing CSS with Eric Meyer’s excellent reset.css. reset.css resolved frustrating inconsistencies between browsers by giving them all the same empty canvas. Nicolas Gallagher and I eventually wrote normalize.css with a new approach; style the bare minimum to keep every browser looking the same, and when in doubt follow the standard. Nicolas has since turned normalize.css into a household web standard.

Years have passed and CSS has changed dramatically. I don’t want to calculate the combined values of padding and width, so I set box-sizing to border-box. I don’t want to remember to update my background-repeat to none so they stop repeating automatically. CSS gives me a way to do these things.

sanitize.css contains the baseline styles many of us end up writing anyway, especially if you listen to the two biggest influences of this project; Paul Irish and Chris Coyier. These two have dedicated themselves to development and best practices for years. I’ve simply poured some of their tastes into a file.

sanitize.css follows in the footsteps of normalize.css and reset.css — standardizing browsers while giving me the canvas I want to play with.

I hope it helps you as much as it helps me.