Git Product home page Git Product logo

sanitize.css's Introduction

sanitize.css sanitize

sanitize.css is a CSS library that provides consistent, cross-browser default styling of HTML elements alongside useful defaults.

sanitize.css is developed alongside normalize.css, which means every normalization is included, and every normalization and opinion are clearly marked and documented.

sanitize.css wraps styles in zero-specificity selectors using :where().

Usage

<link href="https://cdn.skypack.dev/sanitize.css" rel="stylesheet" />

Learn more about sanitize.css.

Forms CSS

A separate stylesheet that normalizes form controls without side effects.

<link href="https://unpkg.com/sanitize.css/forms.css" rel="stylesheet" />

Learn more about forms.css.

Assets CSS

A separate stylesheet that applies a comfortable measure to plain documents.

<link href="https://unpkg.com/sanitize.css/assets.css" rel="stylesheet" />

Learn more about assets.css.

Typography CSS

A separate stylesheet that normalizes typography using system interface fonts.

<link href="https://unpkg.com/sanitize.css/typography.css" rel="stylesheet" />

Learn more about typography.css.

Reduce Motion CSS

A separate stylesheet for restricting motion when the user has requested this at system level.

<link href="https://unpkg.com/sanitize.css/reduce-motion.css" rel="stylesheet" />

Learn more about reduce-motion.css.

System-UI

A separate stylesheet that adds support for using system-ui in Firefox.

<link href="https://unpkg.com/sanitize.css/system-ui.css" rel="stylesheet" />

UI-Monospace

A separate stylesheet that adds support for using ui-monospace in Chrome, Edge, and Firefox.

<link href="https://unpkg.com/sanitize.css/ui-monospace.css" rel="stylesheet" />

Install

npm install sanitize.css --save

Webpack Usage

Import sanitize.css in CSS:

@import '~sanitize.css';
@import '~sanitize.css/forms.css';
@import '~sanitize.css/typography.css';

Alternatively, import sanitize.css in JS:

import 'sanitize.css';
import 'sanitize.css/forms.css';
import 'sanitize.css/typography.css';

In webpack.config.js, be sure to use the appropriate loaders:

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [ 'style-loader', 'css-loader' ]
      }
    ]
  }
}

Download

See https://csstools.github.io/sanitize.css/latest/sanitize.css

What does it do?

  • Normalizes styles for a wide range of elements.
  • Corrects bugs and common browser inconsistencies.
  • Provides common, useful defaults.
  • Explains what code does using detailed comments.

Browser support

  • Chrome (last 2)
  • Edge (last 2)
  • Firefox (last 2)
  • Firefox ESR
  • Opera (last 2)
  • Safari (last 2)
  • iOS Safari (last 2)
  • Internet Explorer 9+

Differences

normalize.css and sanitize.css correct browser bugs while carefully testing and documenting changes. normalize.css styles adhere to css specifications. sanitize.css styles adhere to common developer expectations and preferences. reset.css unstyles all elements. Both sanitize.css and normalize.css are maintained in sync.

Features

Box sizing defaults to border-box
*, ::before, ::after {
  box-sizing: border-box;
}
Backgrounds do not repeat by default
*, ::before, ::after {
  background-repeat: no-repeat;
}
Pseudo-elements inherit text decoration and vertical alignment
::before,
::after {
  text-decoration: inherit;
  vertical-align: inherit;
}
Cursors only change to hint non-obvious interfaces
html {
  cursor: default;
}
Text has a comfortable line height in all browsers
html {
  line-height: 1.5;
}
Tabs appear the same on the web as in a typical editor
html {
  tab-size: 4;
}
Words break to prevent overflow
html {
  word-break: break-all;
}
Documents do not use a margin for outer padding
body {
  margin: 0;
}
Navigation lists do not include a marker style
nav ol, nav ul {
  list-style: none;
  padding: 0;
}
Media elements align to the text center of other content
audio, canvas, iframe, img, svg, video {
  vertical-align: middle;
}
SVGs fallback to the current text color
svg:not([fill]) {
  fill: currentColor;
}
Tables do not include additional border spacing
table {
  border-collapse: collapse;
}
Textareas only resize vertically by default
textarea {
  resize: vertical;
}
Single taps are dispatched immediately on clickable elements
a, area, button, input, label, select, summary, textarea, [tabindex] {
  -ms-touch-action: manipulation;
  touch-action: manipulation;
}
ARIA roles include visual cursor hints
[aria-busy="true"] {
  cursor: progress;
}

[aria-controls] {
  cursor: pointer;
}

[aria-disabled="true"], [disabled] {
  cursor: default;
}
Visually hidden content remains accessible
[aria-hidden="false"][hidden] {
  display: initial;
}

[aria-hidden="false"][hidden]:not(:focus) {
  clip: rect(0, 0, 0, 0);
  position: absolute;
}

Forms

sanitize.css includes a separate stylesheet for normalizing forms using minimal, standards-like styling.

<link href="https://unpkg.com/sanitize.css" rel="stylesheet" />
<link href="https://unpkg.com/sanitize.css/forms.css" rel="stylesheet" />

Forms Features

Form controls appear visually consistent and restyle consistently
button, input, select, textarea {
  background-color: transparent;
  border: 1px solid WindowFrame;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  padding: 0.25em 0.375em;
}

[type="color"],
[type="range"] {
  border-width: 0;
  padding: 0;
}
Expandable select controls appear visually consistent
select {
  -moz-appearance: none;
  -webkit-appearance: none;
  background: no-repeat right center / 1em;
  border-radius: 0;
  padding-right: 1em;
}

select:not([multiple]):not([size]) {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='4'%3E%3Cpath d='M4 0h6L7 4'/%3E%3C/svg%3E");
}

::-ms-expand {
  display: none;
}
Placeholders appear visually consistent in Internet Explorer
:-ms-input-placeholder {
  color: rgba(0, 0, 0, 0.54);
}

Assets

sanitize.css includes a separate stylesheet for normalizing restricting the size of assets in all browsers.

<link href="https://unpkg.com/sanitize.css" rel="stylesheet" />
<link href="https://unpkg.com/sanitize.css/assets.css" rel="stylesheet" />

Assets Features

Assets use a comfortable measure in all browsers
iframe,
img,
input,
select,
textarea {
  height: auto;
  max-width: 100%;
}

Typography

sanitize.css includes a separate stylesheet for normalizing typography using system interface fonts.

<link href="https://unpkg.com/sanitize.css" rel="stylesheet" />
<link href="https://unpkg.com/sanitize.css/typography.css" rel="stylesheet" />

Typography Features

Typography uses the default system font
html {
  font-family:
    system-ui,
    /* macOS 10.11-10.12 */ -apple-system,
    /* Windows 6+ */ Segoe UI,
    /* Android 4+ */ Roboto,
    /* Ubuntu 10.10+ */ Ubuntu,
    /* Gnome 3+ */ Cantarell,
    /* KDE Plasma 5+ */ Noto Sans,
    /* fallback */ sans-serif,
    /* macOS emoji */ "Apple Color Emoji",
    /* Windows emoji */ "Segoe UI Emoji",
    /* Windows emoji */ "Segoe UI Symbol",
    /* Linux emoji */ "Noto Color Emoji";
}
Pre-formatted and code-formatted text uses the monospace system font
code, kbd, pre, samp {
  font-family:
    /* macOS 10.10+ */ Menlo,
    /* Windows 6+ */ Consolas,
    /* Android 4+ */ Roboto Mono,
    /* Ubuntu 10.10+ */ Ubuntu Monospace,
    /* KDE Plasma 5+ */ Noto Mono,
    /* KDE Plasma 4+ */ Oxygen Mono,
    /* Linux/OpenOffice fallback */ Liberation Mono,
    /* fallback */ monospace;
}

Reduce Motion

sanitize.css includes a separate stylesheet for restricting motion when the user has requested this at a system level.

<link href="https://unpkg.com/sanitize.css" rel="stylesheet" />
<link href="https://unpkg.com/sanitize.css/reduce-motion.css" rel="stylesheet" />

Reduce Motion Features

Animations, scrolling effects, and transitions are reduced in all browsers
@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-delay: 0s !important;
    transition-duration: 0s !important;
  }
}

Contributing

Please read the contribution guidelines in order to make the contribution process easy and effective for everyone involved.

Acknowledgements

sanitize.css is a project by Jonathan Neal, built upon normalize.css, a project by Jonathan Neal, co-created with Nicolas Gallagher.

sanitize.css's People

Contributors

arnorhs avatar bcomnes avatar bjork24 avatar brunorios1 avatar charbelrami avatar chuck0523 avatar ciju avatar cloud-walker avatar dada0423 avatar fabianbeiner avatar filipelinhares avatar jonathantneal avatar levithomason avatar m-e-h avatar m-iskw avatar metaloha avatar nickbabcock avatar nuxodin avatar pascalduez avatar pavasich avatar sanmai-nl avatar sotayamashita avatar ttanimichi avatar tzi avatar ungoldman avatar vitorgalvao avatar vovanbo avatar weotch avatar yuheiy avatar zrothauser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sanitize.css's Issues

Vertical align media elements?

Have you considered the following?

/*
 * Remove the gap between images, videos, audio and canvas and the bottom of
 * their containers: h5bp.com/i/440
 */
audio,
canvas,
img,
svg,
video {
    vertical-align: middle;
}

Update Readme

Hello!

The code lines which are linked in the readme are outdated. :C

Thomas

-ms-autohiding-scrollbar all the things

Check to see if -ms-overflow-style is inherited. If not, set it to inherit. This way, IE (and Edge?) get the nice appearing / disappearing scrollbars on the page and any overflowed element (like a <pre> with code) that we enjoy on Chrome, Firefox, and Safari.

* {
    -ms-overflow-style: inherit;
}

:root {
    -ms-overflow-style: -ms-autohiding-scrollbar;
}

:root { font: 16px/…; } overrides the user’s preferred font size

Just pointing out that the current code overrides the user’s default font-size (that may be set in most browsers’s preferences, including IE, Firefox and Chrome), as would any font-size value using units other than %, em, or rem (or ex but that’s marginal).

Current Sass code:

$root-font-size: 16px !default;
:root {
    font: #{$root-font-size}/#{$root-line-height} $root-font-family;
}

Compiled CSS:

:root{font:1pc/1.5 sans-serif}

(I guess the conversion of 16px to 1pc is something which minify-css does in order to win just one character. A bit overkill. ^^)

Is this an intentional decision to override user settings?

I understand that not many users will have set up their browser to use a different base text size, and with many websites not respecting this preference they are even less likely to use this preference, but I’d still advise against resetting user settings in boilerplate code.

Unintended Sass division in root font

The following line in sanitize.scss:

font: if(variable-exists(root-font-size), $root-font-size, 100%)/#{if(variable-exists(root-line-height), $root-line-height, 1.5)} if(variable-exists(root-font-family), $root-font-family, sans-serif);

is being compiled to:

font: 66.66667% sans-serif

instead of:

font: 100%/1.5 sans-serif;

This only occurs after upgrading node-sass from 3.4.2 to 3.5.1. I don't know whether this is an intentional change in the compiler or a regression in LibSass 3.3.5.

cursor: initial ?

Hi. I've not seen this property on cursor before, is this a typo? On a site I'm working on it's causing some links to have a text selection cursor rather than a pointer (in FireFox - Chrome, however, seems fine).

Sanitize should probably adhere to the specificity graph

After checking the sanitize css in this checker https://jonassebastianohlsson.com/specificity-graph/ It seems it could be improved with a bit of minor juggling. Thoughts?

* {
    background-repeat: no-repeat;
    font-size: inherit;
    line-height: inherit;
    margin: 0;
    padding: 0;
}

*,
:before,
:after {
    border-style: solid;
    border-width: 0;
    box-sizing: inherit;
}

:before,
:after {
    text-decoration: inherit;
    vertical-align: inherit;
}

::-moz-selection {
    background-color: #b3d4fc; /* required when declaring ::selection */
    color: #4c2b03;
    text-shadow: none;
}

::selection {
    background-color: #b3d4fc; /* required when declaring ::selection */
    color: #4c2b03;
    text-shadow: none;
}

a {
    text-decoration: none;
}

audio,
canvas,
iframe,
img,
svg,
video {
    vertical-align: middle;
}

button,
input,
select,
textarea {
    background-color: transparent;
}

button,
input,
select,
textarea {
    color: inherit;
    font-family: inherit;
    font-style: inherit;
    font-weight: inherit;
}

button {
    overflow: visible; /* Internet Explorer 11- */
    -webkit-appearance: button; /* iOS 8+ */
}

details {
    display: block; /* Edge 12+, Firefox 40+, Internet Explorer 11-, Windows Phone 8.1+ */
}

html {
    -ms-overflow-style: -ms-autohiding-scrollbar; /* Edge 12+, Internet Explorer 11- */
    overflow-y: scroll; /* All browsers without overlaying scrollbars */
    -webkit-text-size-adjust: 100%; /* iOS 8+ */
}

main {
    display: block; /* Android 4.3-, Internet Explorer 11-, Windows Phone 8.1+ */
}

pre {
    overflow: auto; /* Internet Explorer 11- */
}

progress {
    display: inline-block; /* Internet Explorer 11-, Windows Phone 8.1+ */
}

small {
    font-size: 75%; /* All browsers */
}

summary {
    display: block; /* Firefox 40+, Internet Explorer 11-, Windows Phone 8.1+ */
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

template {
    display: none; /* Android 4.3-, Internet Explorer 11-, iOS 7-, Safari 7-, Windows Phone 8.1+ */
}

textarea {
    overflow: auto; /* Edge 12+, Internet Explorer 11- */
    resize: vertical;
}

input {
    -webkit-border-radius: 0 /* iOS 8+ */
}

code,
kbd,
pre,
samp {
    font-family: monospace, monospace;
}

select {
    -moz-appearance: none;    /* Firefox 40+ */
    -webkit-appearance: none /* Chrome 45+ */
}

button,
select,
textarea {
    min-height: 1.5em;
}

nav ol,
nav ul {
    list-style: none;
}

select::-ms-expand {
    display: none;/* Edge 12+, Internet Explorer 11- */
}

select::-ms-value {
    color: currentColor;/* Edge 12+, Internet Explorer 11- */
}

[type="button"],
[type="date"],
[type="datetime"],
[type="datetime-local"],
[type="email"],
[type="month"],
[type="number"],
[type="password"],
[type="reset"],
[type="search"],
[type="submit"],
[type="tel"],
[type="text"],
[type="time"],
[type="url"],
[type="week"] {
    min-height: 1.5em;
}

[aria-busy="true"] {
    cursor: progress;
}

[aria-controls] {
    cursor: pointer;
}

[aria-disabled] {
    cursor: default;
}

:root {
    background-color: #ffffff;
    box-sizing: border-box;
    color: #000000;
    cursor: default;
    font: 100%/1.5 sans-serif;
    text-rendering: optimizeLegibility;
}

[hidden] {
    display: none; /* Internet Explorer 10- */
}

audio:not([controls]) {
    display: none; /* Chrome 44-, iOS 8+, Safari 9+ */
}

svg:not(:root) {
    overflow: hidden; /* Internet Explorer 11- */
}

input[type="button"],
input[type="reset"],
input[type="submit"] {
    -webkit-appearance: button;/* iOS 8+ */
}

input[type="number"] {
    width: auto;/* Firefox 36+ */
}

input[type="search"] {
    -webkit-appearance: textfield;/* Chrome 45+, Safari 9+ */
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;/* Chrome 45+, Safari 9+ */
}

[hidden][aria-hidden="false"] {
    clip: rect(0 0 0 0);
    display: inherit;
    position: absolute
}

[hidden][aria-hidden="false"]:focus {
    clip: auto;
}

* { border: 0; }

While doing some testing with this reset I ran into some issues where descendent elements were getting undesired borders. Adding * { border: 0; }was useful for me.

Add Stylus and LESS?

How would feel about adding Stylus and LESS versions of sanitize.scss?

I can make a PR with the current version of the SCSS file converted into those preprocessors if you want.

Set default tab-size to 4

@Alhadis wrote:

the default tab-width of 8 characters used by systems and terminals really doesn't cut it for the web. When code's indented with hard tabs, they're almost always 4-characters wide, not 8. Maybe have a global stylesheet rule to set the tab-size to a sensible value?

This seems like a exactly the kind of opinionated feature meant for Sanitize.css.

Set background on body instead of html?

Setting a background color on html instead of on body may confuse people as it will make the latter "shrink" vertically--as this demo shows.
May be better/safer to style body.

Add to npm?

npm is a great way to package and distribute css now! You can preprocess with grunt or other build tools right out of node_modules, and even better, @import right out of node_moduels using things like browserify

Would you be interested in adding this to npm?

  • Do we need to change the main file to /gulpfile.js or /dist/sanitize.css or /sanitize.scss?
  • How to handle scss vs css?

Sourcemaps and possible features

Kudos on the dist folder @jonathantneal

Should sources be going up a directory? It's current implementation would insinuate the .map was nested in a css/maps/ folder or something. Is this standard practice? I would expect to drop all these into the same folder and maps just work™

image

In lieu of changing "sources":["../sanitize.css"] to "sources":["sanitize.css"] maybe put the maps into a css/maps folder so they work automatically?

What are your thoughts on integrating any of these features?

Happy to start working on this project instead of duplicating our efforts (I think you guys are way ahead of me too so far as all your weird tweaks go). 👍

Perhaps create a test directory with HTML and PhantomCSS tests

I know there is gh-pages, although I didn't know this until I read the previous issues about HTML tests. So test HTML could be made more prominent for people wanting to contribute or test Sanitize.css out.

Perhaps a "tests" directory with specific tests for each case would be useful.

Also, the use of PhantomCSS for visual regression testing could be really useful when testing on updates. Could possibly even automate the entire process and simply run it from "" in the package.json.

Vertical overflow `HTML` to prevent layout 'flickering'

A vertical scrollbar on the page effectively takes up some horizontal space.
When this happens after some user action (e.g. opening a content pane) this could result in the layout shifting slightly to the left.

This can be avoided by always taking up this space: :root { overflow-y: scroll; }

But I'm pretty sure you have good reasons not to include it ;)

Remove -ms-overflow-style: -ms-autohiding-scrollbar; ?

-ms-overflow-style: -ms-autohiding-scrollbar;

Does something like this need to be in sanitize.css? This actually makes scrollbars run over my content which no other browser does AFAIK and just makes stuff look mis-aligned on the right side of the page.

Pure CSS version contains `&` selectors?

I want to use pure CSS version with CSS variables, but /lib/sanitize.css contains & selectors (for example, here), and /sanitize.css doesn't use CSS variables.

Is this mistake, or does it require to be compiled?
If I should compile them, how to?
(Compiling with scss after renaming lib/sanitize.css -> sanitize.scss seems to produce expected pure CSS, but I don't think it is the correct way...)

CSS isn't clean

Not properly indented:
image

Empty rulsets:
image

Selectors not newlined:
image

Comments touching:
image

GitHub's default huge-ass tab indents (fix with .editorconfig):
image

Lack of semi-colons in some places:
image

etc. ad infinitum.

TLC please.

Bower version conflict?

It looks like the latest version of this available on bower is 1.1.0. Any way you could push the latest version up?

border-style: solid on everything?

*, :before, :after { border-style: solid; border-width: 0; }

is this really needed? I don't see what this is supposed to fix?

It causes google map arrows to be positioned wrong.

Direct descendant selector for nav lists

nav ol,
nav ul {
    list-style: var(--nav-list-style, none);
}

Not exactly sure what this code does, I'm guessing it defaults list-style to none (as I don't see --nav-list-style defined in the code). I know this is common practice, but this might not make sense of nested lists. Would something like this make more sense?

nav > ol,
nav > ul {
    list-style: var(--nav-list-style, none);
}

Typography went crazy after v3

Just a heads up, when I installed v3 my typography went haywire. Thinking i would need to tune some things in order to get it working again. Back to normalize for now however.

SVG fill: currentColor?

Whoooboy, this statement messed up my project. (lines 196–198)

I don't think this is intuitive behavior at all. At the very least, it should be a variable.

Firefox button padding

Just ran into an issue with Firefox's default button padding and had to use something from normalize to fix it:

/**
 * Remove inner padding and border in Firefox 4+.
 */

button::-moz-focus-inner,
input::-moz-focus-inner {
  border: 0;
  padding: 0;
}

Is that something you'd consider adding to sanitize.css? Really useful stuff by the way - enjoying the switch from normalize a lot so far.

Global background image properties

What is your take on applying global properties such as background-repeat:no-repeat; or background-position:0 0;? It seems to me that basically the starting point for every background image setting and yet it almost always needs to be reset to these values.

sanitize.css v4 plan

Good news! I’ll have some time to resolve the remaining sanitize.css issues and release v4. Here are the major changes I’m planning. I’d love your feedback.

Normalize

  • Everything (not reset) from normalize.css v4.

Being kept

  • Remove margin and padding (margin: 0; padding: 0).
  • Remove tapping delay (touch-action: manipulation).
  • Remove the text decoration on links.
  • Remove the list style within navigation sections.
  • Fills default to the text color (fill: currentColor).
  • Limit the resize to vertical on text areas.
  • Remove repeated backgrounds by default background-repeat: no-repeat.
  • Specify default text selection styles.
  • Specify default form styles.

Being removed

  • Don’t reset borders border-style: solid; border-width: 0;. While I really enjoy not worrying about border-style. Unfortunately, like overflow: hidden, it comes with unexpected consequences that make it not worth the benefits.
  • Autohiding scrollbars (-ms-overflow-style: -ms-autohiding-scrollbar;).

Being considered

  • Be border box aggressive (* { box-sizing: border-box; }).
  • Inherit all font properties (* { font: inherit; }).
  • Move page background to body (from :root).
  • Default flex to columns (flex-flow: column).
  • Default flex shink to 0 (flex-shrink: 0;).

Not being considered

  • Inherited display (display: inherit).
  • Hidden overflow (overflow: hidden) because it creates unexpected consequences.
  • Relative position (position: relative) because it creates unexpected consequences.

why can not use v2.1.0 with bower?

sanitize.css is published v2.1.0 for npm but not for bower.
Why is the version of the bower package supplied as the older version?
I wish the bower package is published as v2.1.0.

* { background-color:inherit; } is a major cause of pain

@jonathantneal * { background-color: inherit; } is a major cause of pain for us.

Especially in large projects which import components from external projects (read: enterprise scale apps and website).

For example, global components like header, footer, login forms are breaking because of that: for example, transparent elements in a global component, assume undesired background colors from their container element in an app which requires that component.

This has been a major cause of pain for us since we started using sanitize.css, because there is no way to reverse this rule - you'd have to manually add over-riding rules for each HTML element you want to fix - even though the correct background rules are already present in their respective components' stylesheets.

Please consider dropping it, because otherwise we would be forced to drop using sanitize.css, which we favor due to it being great project with a modern approach.

Thanks,
Tom Alon
Wix.com

Remove default list padding from nav lists?

I guess the $default-nav-list-style is none because you assume navigation lists should not be styled as lists. Do we not have to remove the default (left-)padding too then?

nav ol,
nav ul {
    list-style: $default-nav-list-style;
    padding-left: 0;
}

Semantic variable names

I wonder if some of the variable names in this project could be made to be a little more semantic. For instance:

--form-element-background-color targets button, input, select, textarea but perhaps --control-background-color or --form-control-background-color would be more appropriate. Form lacks a certain specificity, especially since there is a <form> element.

I would apply the outcome of the above issue to --form-element-min-height.

--monospace-font-family targets code, kbd, pre, samp but perhaps --markup-font-family or --keyboard-font-family would be more appropriate. I‘m not sure monospace accurately describes the meaning of these elements.

I shouldn’t leave this issue open too long if there isn’t much feedback from the community.

E-Mail Templates

Would you recommend using sanitize.css for email templates too? Thanks a lot!

directional quotes on <q> element

I find this handy, and just wanted to share. Others might find this a useful baseline feature:

q::before {content: "“"}
q::after {content: "”"}

http://codepen.io/anon/pen/rVpZgL

It's better for readability if readers can distinguish easily between a quote beginning or a quote ending. Thanks for sanitize-- I learned a few nice tricks I've put into use.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.