Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backpack.css

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backpack.css

A lightweight and somewhat opinionated CSS foundation that is best suited to applications 🎒.

  • 1.1.0
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
increased by137.19%
Maintainers
1
Weekly downloads
 
Created
Source

backpack.css 🎒

A lightweight and somewhat opinionated CSS foundation that is best suited to applications.

Table of contents

  • Installation
  • How to use
  • Motivation
  • What it does
  • Evolution
  • Browser support
  • Contributing
  • Versioning

Installation

Run the following command using npm:

npm install backpack.css --save-dev

If you prefer Yarn, use this command instead:

yarn add backpack.css --dev

CDN version coming soon, see.

How to use

Typically you'll be wanting to import all of backpack.css styles into your project but you do have the choice to be selective. The one strict rule is that it must come before your project's CSS to ensure correct ordering of your styles and to be able to override any of backpack.css styles.

Importing with a bundler

If you're using a bundler such as webpack and wanting to import all of backpack.css then your projects entry point should look like this:

import 'backpack.css';
import '[path(s)-to-your-project-css]';

If you want to be selective then simply import the backpack.css files you need, for example:

import 'backpack.css/lib/resets.css';
import 'backpack.css/lib/content-sectioning.css';
import 'backpack.css/lib/forms.css';
import '[path(s)-to-your-project-css]';

The order at which you import each module is important, to see this order and what .css files are available refer to backpack.css index.css.

Importing without a bundler

CDN version coming soon, see. In the meantime you can link to the hosted version on UNPKG via a <link> element in your HTML Head, however, make sure it comes before your project's CSS, e.g.:

<head>
  […]
  <link rel="stylesheet" href="https://unpkg.com/backpack.css">
  <link rel="stylesheet" href="[path-to-your-project-css]">
</head>

Overriding

backpack.css is just CSS so you can easily override any of backpack.css styles just as you would override any CSS, as in, via the rules of the cascade and specificity.

For example, if you don't want to use system-ui as the global font-family set in main-root.css then simply redeclare it in your project CSS like so:

html {
  font-family: serif;
}

Motivation

Nowadays I'm building React applications that have highly componentised User Interfaces (UI) making use of native CSS layout mechanisms such as Flexbox and Grid. I'm no longer finding the need for heavy handed CSS frameworks that handle most of my UI concerns, especially layout and utilities. Instead I build components with a smidgen of global styles.

What I do need, however, are a bunch of smart and sensible foundational styles suited for applications that I would typically forget project to project—think Normalize.css and then some. Something that is lightweight, super easy to intergrate, and can easily be overriden or allow for modular use, thus giving birth to backpack.css 🙂🎒.

What it does

  • Applies sensible form element resets, normalisations, and fixes, e.g.: remove all user-agent styles from buttons.
  • Applies sensible interactive styles, e.g.: avoid 300ms click delay on touch devices.
  • Applies foundational print styles.
  • Applies the nicer border-box value for the box-sizing property to all elements.
  • Applies sensible OpenType features, e.g.: enables lining numerals, tabular numerals, and slashed zero, for table content.
  • Makes all images responsive.
  • Removes margins, paddings, and borders from all elements except <input> so that everything is on an even playing field.
  • Removes list bullets.
  • Removes all user-agent styles from heading elements and resets them to have the same styles as the body copy.

And more…

All of the CSS is very well documentated if you want to dig deeper.

Evolution

This is the third CSS framework/library I've created. Looking at each one lets you see how UI development has evolved over the years with each iteration getting smaller and smaller.

  1. Scally circa 2014
  2. Shell circa 2016
  3. backpack.css circa 2018

Browser support

  • Chrome
  • Edge
  • Firefox
  • Internet Explorer 11 (partial)
  • Safari 10+
  • Opera

Not everything will work in Internet Explorer 11, e.g.: the system-ui font, however, anything that doesn't work will simply degrade gracefully.

It's recommended to have Autoprefixer setup as part of your project's build.

Contributing

Please see our contributing guidelines.

Versioning

backpack.css is maintained under the Semantic Versioning guidelines. We'll do our best to adhere to those guidelines and strive to maintain backwards compatibility.

See the change log.

Keywords

FAQs

Package last updated on 06 Oct 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc