npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@shivangswain/preflightcss

v3.4.3

Published

Preflight is a set of base styles that are designed to smooth over cross-browser inconsistencies and make it easier for you to work within the constraints of your design system.

Downloads

15

Readme

Overview

Built on top of modern-normalize, Preflight is a set of base styles that are designed to smooth over cross-browser inconsistencies and make it easier for you to work within the constraints of your design system.

While most of the styles in Preflight are meant to go unnoticed — they simply make things behave more like you'd expect them to — some are more opinionated and can be surprising when you first encounter them.

For a complete reference of all the styles applied by Preflight, see the stylesheet.

⚙️ Installation

Using npm:

npm install @shivangswain/preflightcss

Using yarn:

yarn add @shivangswain/preflightcss

📖 Usage

Using CSS imports:

@import '@shivangswain/preflightcss/preflight.css';

Using ES6 imports:

import '@shivangswain/preflightcss';

🌐 CDN

Using JSDELIVR:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shivangswain/preflightcss/preflight.css">

Using UNPKG:

<link rel="stylesheet" href="https://unpkg.com/@shivangswain/preflightcss/preflight.css">

Default margins are removed

Preflight removes all of the default margins from elements like headings, blockquotes, paragraphs, etc.

blockquote,
dl,
dd,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
figure,
p,
pre {
  margin: 0;
}

This makes it harder to accidentally rely on margin values applied by the user-agent stylesheet that are not part of your spacing scale.


Headings are unstyled

All heading elements are completely unstyled by default, and have the same font-size and font-weight as normal text.

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: inherit;
  font-weight: inherit;
}

The reason for this is two-fold:

  • It helps you avoid accidentally deviating from your type scale. By default, browsers assign sizes to headings that don't exist in Preflight's default type scale, and aren't guaranteed to exist in your own type scale.
  • In UI development, headings should often be visually de-emphasized. Making headings unstyled by default means any styling you apply to headings happens consciously and deliberately.

Lists are unstyled

Ordered and unordered lists are unstyled by default, with no bullets/numbers and no margin or padding.

ol,
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

Accessibility considerations

Unstyled lists are not announced as lists by VoiceOver. If your content is truly a list but you would like to keep it unstyled, add a "list" role to the element:

<ul role="list">
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
</ul>

Images are block-level

Images and other replaced elements (like svg, video, canvas, and others) are display: block by default.

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  vertical-align: middle;
}

This helps to avoid unexpected alignment issues that you often run into using the browser default of display: inline.

If you ever need to make one of these elements inline instead of block, simply use the inline utility:

<img class="inline" src="..." alt="...">

Images are constrained to the parent width

Images and videos are constrained to the parent width in a way that preserves their intrinsic aspect ratio.

img,
video {
  max-width: 100%;
  height: auto;
}

This prevents them from overflowing their containers and makes them responsive by default. If you ever need to override this behavior, use the max-w-none utility:

<img class="max-w-none" src="..." alt="...">

Border styles are reset globally

In order to make it easy to add a border by simply adding the border class, Tailwind overrides the default border styles for all elements with the following rules:

*,
::before,
::after {
  border-width: 0;
  border-style: solid;
  border-color: theme('borderColor.DEFAULT', currentColor);
}

Since the border class only sets the border-width property, this reset ensures that adding that class always adds a solid 1px border using your configured default border color.

This can cause some unexpected results when integrating certain third-party libraries, like Google maps for example.

When you run into situations like this, you can work around them by overriding the Preflight styles with your own custom CSS:

.google-map * {
  border-style: none;
}