sanitize.css

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.

Installation

Install with Bower

bower install --save sanitize-css

Install with NPM

npm install sanitize.css

Use with CSS

@import url(vendors/sanitize.css);

Use with a CDN

See https://cdnjs.com/libraries/10up-sanitize.css

View GitHub Download 4.0.0

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 need to hurt my brain calculating the combined values of padding and width. I don’t have to remember to update my backgrounds so they stop repeating automatically. CSS gives me a way to fix the box model and the background. CSS gives me a way to define the baseline that I need most of the time.

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 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.