自动添加浏览器兼容前缀的插件。
以VS Code为例:
在应用商店里搜索扩展autoprefixer,如图:

点击安装。
然后就可以使用啦。
那么要怎么使用呢?比如我写一个样式如下:
.example {
display: flex;
transition: all .5s;
user-select: none;
background: linear-gradient(to bottom, white, black);
}
在VS Code编辑界面,右键,选择“命令面板”,或者ctrl+shift+P调出命令面板,输入autoprefixer关键字,点击一下:

然后代码就变成带有浏览器兼容前缀的了,如下:
.example {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-transition: all .5s;
transition: all .5s;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background: -webkit-linear-gradient(top, white, black);
background: linear-gradient(to bottom, white, black);
}
网友评论