web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.6 KiB

  1. # PostCSS Overflow Shorthand [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss]
  2. [![NPM Version][npm-img]][npm-url]
  3. [![CSS Standard Status][css-img]][css-url]
  4. [![Build Status][cli-img]][cli-url]
  5. [![Support Chat][git-img]][git-url]
  6. [PostCSS Overflow Shorthand] lets you use the `overflow` shorthand in CSS,
  7. following the [CSS Overflow] specification.
  8. ```pcss
  9. html {
  10. overflow: hidden auto;
  11. }
  12. /* becomes */
  13. html {
  14. overflow-x: hidden;
  15. overflow-y: auto;
  16. overflow: hidden auto;
  17. }
  18. ```
  19. ## Usage
  20. Add [PostCSS Overflow Shorthand] to your project:
  21. ```bash
  22. npm install postcss-overflow-shorthand --save-dev
  23. ```
  24. Use [PostCSS Overflow Shorthand] to process your CSS:
  25. ```js
  26. const postcssOverflowShorthand = require('postcss-overflow-shorthand');
  27. postcssOverflowShorthand.process(YOUR_CSS /*, processOptions, pluginOptions */);
  28. ```
  29. Or use it as a [PostCSS] plugin:
  30. ```js
  31. const postcss = require('postcss');
  32. const postcssOverflowShorthand = require('postcss-overflow-shorthand');
  33. postcss([
  34. postcssOverflowShorthand(/* pluginOptions */)
  35. ]).process(YOUR_CSS /*, processOptions */);
  36. ```
  37. [PostCSS Overflow Shorthand] runs in all Node environments, with special
  38. instructions for:
  39. | [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
  40. | --- | --- | --- | --- | --- | --- |
  41. ## Options
  42. ### preserve
  43. The `preserve` option determines whether the original `overflow` declaration is
  44. preserved. By default, it is preserved.
  45. ```js
  46. postcssOverflowShorthand({ preserve: false })
  47. ```
  48. ```pcss
  49. html {
  50. overflow: hidden auto;
  51. }
  52. /* becomes */
  53. html {
  54. overflow-x: hidden;
  55. overflow-y: auto;
  56. }
  57. ```
  58. [cli-img]: https://img.shields.io/travis/jonathantneal/postcss-overflow-shorthand.svg
  59. [cli-url]: https://travis-ci.org/jonathantneal/postcss-overflow-shorthand
  60. [css-img]: https://cssdb.org/badge/overflow-property.svg
  61. [css-url]: https://cssdb.org/#overflow-property
  62. [git-img]: https://img.shields.io/badge/support-chat-blue.svg
  63. [git-url]: https://gitter.im/postcss/postcss
  64. [npm-img]: https://img.shields.io/npm/v/postcss-overflow-shorthand.svg
  65. [npm-url]: https://www.npmjs.com/package/postcss-overflow-shorthand
  66. [CSS Overflow]: https://drafts.csswg.org/css-overflow/#propdef-overflow
  67. [Gulp PostCSS]: https://github.com/postcss/gulp-postcss
  68. [Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
  69. [PostCSS]: https://github.com/postcss/postcss
  70. [PostCSS Loader]: https://github.com/postcss/postcss-loader
  71. [PostCSS Overflow Shorthand]: https://github.com/jonathantneal/postcss-overflow-shorthand