![Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack](https://cdn.sanity.io/images/cgdhsj6q/production/6af25114feaaac7179b18127c83327568ff592d1-1024x1024.webp?w=800&fit=max&auto=format)
Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
sanitize.css
Advanced tools
Package description
The sanitize.css package is a CSS library that provides consistent, cross-browser default styling for HTML elements. It's designed to normalize styles across different browsers, remove default margins, and apply a consistent box-sizing model. This helps in creating a more predictable styling baseline for web projects.
Normalize styles
This code ensures that every element on the page, including pseudo-elements, inherits the box-sizing property from the html element, which is set to border-box. This makes it easier to manage layouts as it includes padding and border in the element's total width and height.
html { box-sizing: border-box; } *, *::before, *::after { box-sizing: inherit; }
Remove default margins
This code removes the default margins from common elements like body, headings, paragraphs, and others. It provides a clean slate for adding custom spacing without having to override browser defaults.
body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
Set default font-family
This sets the default font family to sans-serif for the entire HTML document, ensuring a consistent typography baseline across different browsers.
html { font-family: sans-serif; }
normalize.css is a popular CSS reset library that aims to normalize styles across browsers. It focuses on fixing common inconsistencies and preserving useful defaults rather than unifying all styles like sanitize.css. While both aim to provide a consistent styling baseline, normalize.css is more about correcting quirks without imposing a specific styling philosophy.
reset-css is another CSS reset library that aims to strip away all default browser styling on elements. Unlike sanitize.css, which applies minimalistic default styles and normalizes differences, reset-css provides a clean slate by removing all styles, allowing developers to start styling from scratch.
Changelog
3.1.0 (February 1, 2016)
touch-action: manipulation
to remove delays during mobile tappingtext-rendering
due to performance issues::selection
color variable corrected to --selection-color
Readme
Render elements consistently. Style with best practices.
Bower
bower install --save sanitize-css
NPM
npm install sanitize.css
Sass
@import 'vendors/sanitize.scss';
CSS
@import url(vendors/sanitize.css);
Sanitize.css styles browsers to render elements more consistently with developer expectations and preferences. Normalize.css styles browsers to render elements more consistently with each other. Reset.css unstyles every element. Each one has its own advantages.
In Sanitize.css, CSS inheritance is assigned universally so that styles cascade naturally and consistently. Wherever possible, the box model operates more intuitively. Every normalization and opinionated default is carefully documented, and most are configurable from Sass.
To give you complete control, sanitize.css is available in three flavors; CSS, SCSS, and Stylus. Each flavor allows you to define your own defaults for box-sizing, font family, text rendering, selection, etc. - all without over-declaring them later.
/* overwrite defaults in sanitize.css */
:root {
--root-font-family: "Open Sans", sans-serif;
--root-color: #333;
}
import url("vendors/sanitize.css");
// overwrite defaults in sanitize.scss
$root-font-family: "Open Sans", sans-serif;
$root-color: #333;
import "vendors/sanitize.scss";
// overwrite defaults in sanitize.styl
root-font-family = "Open Sans", sans-serif
root-color = #333
@import "vendors/sanitize.styl"
#FFFFFF
.border-box
.#000000
.default
.sans-serif
.100%
.1.5
.optimizeLegibility
.none
.no-repeat
.transparent
.1.5em
middle
.monospace
.none
.#b3d4fc
.#ffffff
.none
.75%
.collapse
.0
.vertical
.At present, we support the current and previous major releases of popular web browsers. When a new version is released, we begin supporting that version and stop supporting the third most recent version. Many older browsers happen to be remain supported using the same CSS without additional needs.
Currently tested and supported browsers include Android 4.3-4.4+, Chrome 39-45+, Edge 12+, Firefox 34-40+, Internet Explorer 9-11, iOS 7-8+, Safari 7-9+, Windows Phone 8.1+.
sanitize.css is dedicated to the public domain.
FAQs
A best-practices CSS foundation
The npm package sanitize.css receives a total of 2,543,880 weekly downloads. As such, sanitize.css popularity was classified as popular.
We found that sanitize.css demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.