🐒 Normalize browsers' default style

Overview

Differences from normalize.css

All credit should go to normalize.css. I just removed some cruft and added some improvements. If you have questions about the source, check out the original source and this for details.

The goal of this project is to make itself obsolete.

Browser support

  • Latest Chrome
  • Latest Firefox
  • Latest Safari

Install

$ npm install modern-normalize
Download
CDN

Usage

@import 'node_modules/modern-normalize/modern-normalize.css';

or

<link rel="stylesheet" href="node_modules/modern-normalize/modern-normalize.css">

FAQ

Can you provide Sass, Less, etc, ports?

There's absolutely no reason to have separate ports for these. They are just CSS supersets and can import CSS directly.

Related

Comments
  • Provide system fonts

    Provide system fonts

    Are there any downsides to setting this by default?

    body {
    	font-family:
    		'-apple-system',
    		'system-ui',
    		'BlinkMacSystemFont',
    		'Segoe UI',
    		'Roboto',
    		'Helvetica Neue',
    		'Arial',
    		'sans-serif',
    		'Apple Color Emoji',
    		'Segoe UI Emoji',
    		'Segoe UI Symbol';
    }
    

    Users then get good defaults but can override it with their own body selector if they want.

    Alternatively, if this gets a lot of resistance, we could provide a CSS variable, so users who want it can just do:

    body {
    	font-family: var(--system-fonts);
    }
    

    Thoughts?

    (If you 👎 please also share your thoughts on why)

    enhancement question 
    opened by sindresorhus 14
  • Add acceptance tests

    Add acceptance tests

    A starting point to create acceptance tests and to validate outdated styles (will close #1, close #22)


    IssueHunt Summary

    Referenced issues

    This pull request has been submitted to:


    IssueHunt has been backed by the following sponsors. Become a sponsor

    opened by rafaelfbs 9
  • Fix `tab-size`

    Fix `tab-size`

    I would like to change the tab-size from 8 to 4. I realize it's not strictly a normalization, as all browsers use 8, but it would improve the experience for everyone, so I think it's worth an exception. 8 is just a really really bad default. It has, for example, made tab-indented code on the web unreadable (https://github.com/isaacs/github/issues/170).

    I propose adding the following:

    :root {
    	-moz-tab-size: 4;
    	tab-size: 4;
    }
    

    Using :root so users can easily override it on a per-element basis.

    Thoughts?

    (If you 👎 please also share your thoughts on why)

    enhancement question 
    opened by sindresorhus 8
  • Remove more outdated styles

    Remove more outdated styles

    I've already removed a lot of outdated styles (https://github.com/sindresorhus/modern-normalize/commit/c2e7aa3009b2a2391fabca66326a88bbffd16acf https://github.com/sindresorhus/modern-normalize/commit/b52144d04b756539ac5ac8734213ed812f349d2a), but I'm sure there are more things that are fixed in browsers by now. We should go through the styles and check whether they're still valid in latest Chrome and Firefox.

    enhancement help wanted good first issue 
    opened by sindresorhus 8
  • Differences from normalize, 'Doesn't force font-family...' is no longer valid

    Differences from normalize, 'Doesn't force font-family...' is no longer valid

    As of recent, Normalize.css now uses font-family: inherit; for input elements.

    https://github.com/necolas/normalize.css/commit/ca8a357baf6e724ab84843ac4607f8d2024cf0f8

    opened by lacymorrow 4
  • Don't inherit box-sizing by default

    Don't inherit box-sizing by default

    We previously had * { box-sizing: inherit } in our design system, and chose to remove it because it caused more problems than it fixed. It's rather annoying to need box-sizing: content-box on a specific element, and having to write out:

    .target { box-sizing: content-box; }
    .target *, .target *::before, .target *::after { box-sizing: border-box; }
    

    And then realizing that's incorrect, it should actually be this:

    .target { box-sizing: content-box; }
    .target::before, .target::after, .target > *, .target > *::before, .target > *::after  { box-sizing: border-box; }
    

    The only time where having it this way actually helped was the times when a third-party widget expected to have content-box by default (and for some reason didn't set it itself). Which was actually pretty rare occurrence these days, and the box-sizing: inherit doesn't really help because you still need to debug why the layout is all wrong.

    But when content-box was needed without being set, it was much easier to either wrap the third party component in a utility class that switched box models, or to just apply the style to the widget that required it with notes on why it was needed.

    All in all, we found that * { box-sizing: inherit } does more harm than good. So I thought I'd suggest the change here

    opened by jamiebuilds 3
  • Add some tests

    Add some tests

    Issuehunt badges

    It could be useful for this project to stay up to date with the default values of the declarations which are normalized here within the supported browsers.

    This should be possible by testing the output of window.getComputedStyle() against what is expected from each browser, and the results can be used to remove rules which are no longer needed in recent versions.

    If we want to be more ambitious, it can potentially also be used to find new differences between other elements that should potentially be normalized as well.


    IssueHunt Summary

    rafaelfbs rafaelfbs has been rewarded.

    Backers (Total: $40.00)

    Submitted pull Requests


    Tips


    IssueHunt has been backed by the following sponsors. Become a sponsor

    enhancement help wanted :gift: Rewarded on Issuehunt 
    opened by Zirro 3
  • @import: dependency was not found

    @import: dependency was not found

    I'm using webpack and the modern-normalize.css was not found with the import path provided in the readme. I had to use the tilde character to point to the node_modules folder. I thought it would be nice to share this tip with others.

    Thanks for this normalizing style-sheet. It's perfect for projects where I don't care about non evergreen browsers 👍

    opened by mornir 3
  • Improvements

    Improvements

    Hello, First of all, love this project!

    I have a couple of personal suggestions tough:

    • Maybe it is an idea to add an pre compiled minified version.
    • Maybe a scss/less version.
    • Add to common cdn providers (don't know it this is easy).
    • Maybe for the people that live under a stone add it to bower.
    opened by fridzema 3
  • More accessible line height

    More accessible line height

    Hey, first of all, nice project.

    I am just wonder why you set the line-height to 115% (https://github.com/sindresorhus/modern-normalize/blob/master/modern-normalize.css#L25)? Is it because the default leading for most browsers is between 110% to 120%?

    The line height typically recommended in typography is 120–145%. Do you have a special reason? Otherwise I would recommend something like 130%, because it still looks nice, but greater leading is actually a good practise for accessibility. You could even go all the way up to 150% which is the recommended leading by the W3C accessibility guidelines.

    I would think if we want to normalize, we could also try to normalize not just to the defaults, but also a little bit in the direction of an overall accessible web. Looking forward to your thoughts. 👋

    opened by lukasoppermann 3
  • box-sizing: inherit

    box-sizing: inherit

    The box-sizing: border-box; fix is one of the first normalizing techniques I use when starting from scratch. But since I discovered the improvement by CSS-Tricks and Paul Irish improved the original post, this is the best modern recommendation:

    /* apply a natural box layout model to all elements, but allowing components to change */
    html {
      box-sizing: border-box;
    }
    *, *:before, *:after {
      box-sizing: inherit;
    }
    

    So, my suggestion here is to update the style to follow that. I can do a PR if needed.

    opened by franciscop-invast 2
  • <img>, and <video> display block and max-width 100%

    , and

    What I'm always doing is img display block and max-width 100%. I'm sure this can only be added to a new major version.

    Even if you don't added I'm curious what do you think why it should not be added or what you prefer as defaults for img tag?

    opened by alexander-schranz 0
  • heading and paragraph margin top

    heading and paragraph margin top

    Would it be worth setting all h1 and p etc. tags to have 0 margin on the top?

    By default Chrome sets "margin-block-start: 0.67em;" on to heading elements and "margin-block-start: 1em;" on to p.

    I find it pretty useless as the margin top collapses away if the element is preceded by another heading or paragraph element. But also the first heading or paragraph that you add to any container that has padding ends up too far away from the top.

    image

    For context, the popular (yet older) "normalize.css" does not get rid of the margin top, but Bootstrap's "reboot" does get rid of it.

    opened by Superhands89 1
  • Only show dotted underline on abbr[title] if @media (supports: hover) media query

    Only show dotted underline on abbr[title] if @media (supports: hover) media query

    Currently we have this:

    abbr[title] {
      text-decoration: underline dotted;
    }
    

    This means that abbr tags have dotted underline even on iPhone and iPad where its impossible to see the title as browser doesn't support hover - even with a mouse connected.

    I propose to change this to:

    @media (hover: none) {
      abbr[title] {
        text-decoration: none;
      }
    }
    
    @media (hover: hover) {
      abbr[title] {
        text-decoration: underline dotted;
      }
    }
    
    opened by coliff 1
  • Replace deprecated box-sizing fix by a better one

    Replace deprecated box-sizing fix by a better one

    see https://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/. Even Paul Irish, original author of the fix currently part of modern-normalize, has agreed on this and edited his origjnal post back from 2021: https://www.paulirish.com/2012/box-sizing-border-box-ftw/

    This will also fix https://github.com/sindresorhus/modern-normalize/issues/48.

    opened by franktopel 0
  • Outdated `:-moz-focusring` makes form elements less accessible

    Outdated `:-moz-focusring` makes form elements less accessible

    The package applies an outdated inaccessible focus ring to form elements in firefox:

    /**
    Restore the focus styles unset by the previous rule.
    */
    
    :-moz-focusring {
    	outline: 1px dotted ButtonText;
    }
    

    This thin dotted gray line is inaccessible, outdated. Browsers have updated their default focus styles to be much more accessible, including Firefox.

    Here an unstyled, focused textarea (without modern-normalize):

    image

    https://codepen.io/rickymetz/pen/ZrbXqJ

    It would be fantastic if modern-normalize could undo the custom application of an inaccessible legacy Firefox focus style.

    enhancement help wanted 
    opened by LeoniePhiline 4
Releases(v1.1.0)
  • v1.1.0(May 2, 2021)

  • v1.0.0(Aug 21, 2020)

    • Fix hr border color inheritance in Firefox (#43) 5cb9f1c
    • Normalize table properties across browsers (#41) 766543c
    • Improve consistency with @csstools/normalize.css (#40) db25c02

    https://github.com/sindresorhus/modern-normalize/compare/v0.7.0...v1.0.0

    Source code(tar.gz)
    Source code(zip)
  • v0.7.0(Jul 6, 2020)

    • Remove fieldset padding for Safari (#39) ba92eea
    • Add ui-monospace font name fdc9466

    https://github.com/sindresorhus/modern-normalize/compare/v0.6.0...v0.7.0

    Source code(tar.gz)
    Source code(zip)
  • v0.6.0(Dec 23, 2019)

    Possibly breaking

    • Don't inherit box-sizing by default (#37) c9adb78 See the explanation in https://github.com/sindresorhus/modern-normalize/pull/37.

    Enhancements

    • Replace BlinkMacSystemFont font with system-ui f37ff5a
    • Improve monospaced font on Chrome Android c204a08
    • Drop Segoe UI Symbol as a fallback 6d5695a
    • Add version number in the CSS file c1d65e3

    https://github.com/sindresorhus/modern-normalize/compare/v0.5.0...v0.6.0

    Source code(tar.gz)
    Source code(zip)
Owner
Sindre Sorhus
Full-Time Open-Sourcerer. Wants more empathy & kindness in open source. Focuses on Swift & JavaScript. Makes macOS apps, CLI tools, npm packages. Likes unicorns
Sindre Sorhus
Dropbox’s (S)CSS authoring style guide

Dropbox (S)CSS Style Guide “Every line of code should appear to be written by a single person, no matter the number of contributors.” —@mdo General Do

Dropbox 890 Jan 4, 2023
A markdown based documentation system for style guides.

Hologram Hologram is a Ruby gem that parses comments in your CSS and helps you turn them into a beautiful style guide. There are two steps to building

Trulia, LLC. 2.2k Nov 12, 2022
Easily create and maintain style guides using CSS comments

mdcss lets you easily create and maintain style guides with CSS comments using Markdown. /*--- title: Buttons section: Base CSS --- Button styles c

Jonathan Neal 679 Oct 4, 2022
[ON HOLD] Living Style Guides Engine and Maintenance Environment for Front-end Components. Core repository.

[ON HOLD] SourceJS - Living Style Guide Platform The project been stale for a while and currently is in the [ON HOLD] state until we find new maintain

SourceJS 552 Nov 8, 2022
Automatically generate a style guide from your stylesheets.

StyleDocco StyleDocco generates documentation and style guide documents from your stylesheets. Stylesheet comments will be parsed through Markdown and

Jacob Rask 1.1k Sep 24, 2022
styled component for react & style-loader/usable

react-styled ES7 decorator for dynamic stylesheet usage w/ webpack install $ npm install bloody-react-styled --save-dev require import styled from "bl

Matthias Le Brun 37 Sep 26, 2022
Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress ?? Looking for v5? The master branch is un

styled-components 38k Dec 31, 2022
NES-style CSS Framework | ファミコン風CSSフレームワーク

日本語 / 简体中文 / Español / Português / Русский / Français NES.css is a NES-style(8bit-like) CSS Framework. Installation Styles NES.css is available via ei

null 19.2k Jan 5, 2023
Normalize default email client styles.

About CSS resets for default styles in email clients Like browsers, email clients use default styles for HTML. Unlike browsers, there is little to no

Maizzle 35 Jan 3, 2023
Adds OpenType features—ligatures, kerning, and more—to Normalize.css.

Note You might also like my more recent take on this project, Utility OpenType: CSS utility classes for advanced typographic features. Normalize-OpenT

Kenneth Ormandy 795 Dec 23, 2022
Javascript client for Sanity. Works in node.js and modern browsers (older browsers needs a Promise polyfill).

@sanity/client Javascript client for Sanity. Works in node.js and modern browsers (older browsers needs a Promise polyfill). Requirements Sanity Clien

Sanity 23 Nov 29, 2022
This package generates a unique ID/String for different browsers. Like chrome, Firefox and any other browsers which supports canvas and audio Fingerprinting.

Broprint.js The world's easiest, smallest and powerful visitor identifier for browsers. This package generates a unique ID/String for different browse

Rajesh Royal 68 Dec 25, 2022
Base62-token.js - Generate & Verify GitHub-style & npm-style Base62 Tokens

base62-token.js Generate & Verify GitHub-style & npm-style Secure Base62 Tokens Works in Vanilla JS (Browsers), Node.js, and Webpack. Online Demo See

Root 4 Jun 11, 2022
Extends the default Bootstrap Modal class. Responsive, stackable, ajax and more.

Note: Since this plugin was created to solve a lot of the issues with BS2, it still uses the BS2 markup syntax. Currently I believe the default BS3 mo

Jordan Schroter 5k Dec 28, 2022
DOMPurify - a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. DOMPurify works with a secure default, but offers a lot of configurability and hooks. Demo:

DOMPurify DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. It's also very simple to use and get started with

Cure53 10.2k Jan 7, 2023
An Betterdiscord plugin that gives the capability to the user send all discord stickers, expect wumpus default stickers.

allstickersexpectwumpusstickers An Betterdiscord plugin that gives the capability to the user send all discord stickers, expect wumpus default sticker

null 2 May 23, 2022
Use plain functions as modifiers. Polyfill for RFC: 757 | Default Modifier Manager

Use plain functions as modifiers. Polyfill for RFC: 757 | Default Modifier Manager

null 7 Jan 14, 2022
This is an unofficial front end for Hacker News, reminiscent of the Windows XP era Outlook email client on a Windows XP default desktop

Hacker XP Hacker News styled as the Windows XP Outlook email client. Try out Hacker XP here! Description This is an unofficial front end for Hacker Ne

null 19 Jul 12, 2022
A default Next.js project with boilerplate packages and configurations. Includes Tailwind, TypeScript (strict), ESLint, Prettier, and Husky.

Yet another Next.js project template This template includes a set of our favorite dev tools scaffolded into a Next.js project. Tools include: TypeScri

Joey McKenzie 16 Dec 27, 2022