postcss-safe-area
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

PostCSS Safe Area

PostCSS plugin that adds browser fallbacks for safe-area env variables.

Old iOS and Android browsers don't support environment variables that are required for CSS safe areas. This plugin adds all neccessary fallbacks, and supports calc() as well as shorthand properties for multiple margin or padding values.

.foo {
  padding-top: env(safe-area-inset-top);
  margin: 5em 5em calc(5em + env(safe-area-inset-bottom)) 5em;
}
.foo {
  padding-top: 0;
  padding-top: constant(safe-area-inset-top);
  padding-top: env(safe-area-inset-top);
  margin: 5em 5em calc(5em + 0px) 5em;
  margin: 5em 5em calc(5em + constant(safe-area-inset-bottom)) 5em;
  margin: 5em 5em calc(5em + env(safe-area-inset-bottom)) 5em;
}

Installation and Usage

Install this dependency using

npm install postcss-safe-area --save-dev

Now you can use the plugin using

postcss([require('postcss-safe-area')])

See PostCSS docs for examples for your environment.

Package Sidebar

Install

npm i postcss-safe-area

Weekly Downloads

708

Version

0.1.1

License

MIT

Unpacked Size

5.03 kB

Total Files

6

Last publish

Collaborators

  • plegner