包详细信息

postcss-opacity

iamvdo26.2kMIT5.0.0

PostCSS plugin to add opacity filter for IE8 and legacy browsers

postcss, css, postcss-plugin, opacity

自述文件

PostCSS Opacity Build Status

PostCSS plugin that adds support for legacy browser opacity alternatives.

Example

postcss([
    require('postcss-opacity')
])
/* Input example */
.foo {
  opacity: .5;
}
/* Output example */
.foo {
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
  opacity: .5;
}

Legacy

Support for IE 5-7, Safari 1.X, Netscape

postcss([
    require('postcss-opacity')({
        legacy: true    
    })
])
/* Input example */
.foo {
  opacity: .5;
}
/* Output example */
.foo {
  /* IE 8 */
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";

  /* IE 5-7 */
  filter: alpha(opacity=50);

  /* Netscape */
  -moz-opacity: .5;

  /* Safari 1.x */
  -khtml-opacity: .5;

  /* Modern browsers */
  opacity: .5;
}

See PostCSS docs for examples for your environment.

更新日志

5.0.0 - 2017-07-28

  • Upgrade to PostCSS 6

4.0.0 - 2016-06-28

  • Fixed: -ms-filter before opacity (#10)
  • Added: legacy option to support legacy browsers (#12)

3.0.0 - 2015-09-14

  • Upgrade to PostCSS 5

2.0.1 - 2015-08-12

  • Upgrade to PostCSS 4.1.x

2.0.0 - 2015-03-23

  • Generate fallback for IE8 only

1.0.0 - 2015-02-19

  • Initial release