Skip to content

hcl2020/postcss-overflow-overlay

Repository files navigation

PostCSS Overflow Overlay

npm npm

PostCSS plugin for adding 'overflow: overlay' style for elements with 'overflow: auto' style.

/* Input example */
.foo {
  overflow: auto;
}

/* Output example */
.foo {
  overflow: auto;
  overflow: overlay;
}

🍳 Usage

Step 1: Install plugin:

npm install --save-dev postcss postcss-overflow-overlay

Step 2: Check you project for existed PostCSS config: postcss.config.js in the project root, "postcss" section in package.json or postcss in bundle config.

If you do not use PostCSS, add it according to official docs and set this plugin in settings.

Step 3: Add the plugin to plugins list:

module.exports = {
  plugins: [
+   require('postcss-overflow-overlay'),
    require('autoprefixer')
  ]
}

📝 More Example

/* Input */
.foo {
  overflow-x: auto;
}

/* Output */
.foo {
  overflow-x: auto;
  overflow-x: overlay;
}
/* Input */
.foo {
  overflow: hidden auto;
}

/* Output */
.foo {
  overflow: hidden auto;
  overflow: hidden overlay;
}
/* Input */
.foo {
  overflow: auto !important;
}

/* Output */
.foo {
  overflow: auto !important;
  overflow: overlay !important;
}
/* Input */
.foo {
  overflow: auto;
  overflow: scroll;
}

/* Output */
.foo {
  overflow: auto;
  overflow: overlay;
  overflow: scroll;
}
/* Input */
.foo {
  overflow: auto;
  overflow: auto;
}

/* Output */
.foo {
  overflow: auto;
  overflow: overlay;
  overflow: auto;
}
/* Input */
.foo {
  /** overflow-overlay: off */
  overflow: auto;
}

/* Output */
.foo {
  overflow: auto;
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published