安装pocss插件autoprefixer

本文介绍了如何通过安装和配置autoprefixer插件来处理CSS的浏览器兼容性问题。首先,通过npm安装autoprefixer作为开发依赖。然后查看package.json确认安装成功。接着,在postcss.config.js中设置autoprefixer的规则,指定要兼容的浏览器版本,如Android 4.0及以上和iOS 8及以上。此外,还配置了postcss-pxtorem插件,用于将px单位转换为rem,以适配不同设备的屏幕。

1、安装pocss插件autoprefixer

npm install --save-dev autoprefixer

2、查看package.json

3 在postcss.config.js中添加规则

      'autoprefixer': {
        'overrideBrowserslist': [
          // 'ie >= 8',   //兼容ie7以上浏览器
          // 'Firefox >= 3.5', //兼容火狐版本号大于3.5浏览器
          // 'chrome >= 35',   //兼容chrome版本号大于35浏览器
          // 'opera >= 11.5',   //兼容opera版本号大于11.5浏览器
          'Android >= 4.0', 
          'iOS >= 8',
        ]
      },

postcss.config.js整个文件代码如下(前面已安装过postcss)

module.exports = {
    plugins: {
      'autoprefixer': {
        'overrideBrowserslist': [
          // 'ie >= 8',   //兼容ie7以上浏览器
          // 'Firefox >=
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值