Autoprefixer:一个以最好的方式处理浏览器前缀的后处理程序
Autoprefixer解析CSS文件并且添加浏览器前缀到CSS规则里,使用Can I Use的数据来决定哪些前缀是需要的。
所有你需要做的就是把它添加到你的资源构建工具(例如 Grunt)并且可以完全忘记有CSS前缀这东西。尽管按照最新的W3C规范来正常书写你的CSS而不需要浏览器前缀。像这样:
|
1
2
3
|
a{ transition :transform 1s} |
Autoprefixer使用一个数据库根据当前浏览器的普及度以及属性支持提供给你前缀:
|
1
2
3
4
5
|
a{ -webkit-transition :-webkit-transform 1s; transition :-ms-transform 1s; transition :transform 1s} |
问题
- 当前浏览器列表以及它们的普及度。
- 新CSS属性,值和选择器前缀列表。
- 主流浏览器最近2个版本用“last 2 versions”;
- 全球统计有超过1%的使用率使用“>1%”;
- 仅新版本用“ff>20”或”ff>=20″.
|
1
2
3
4
5
6
7
|
a { background : linear-gradient(to top, black, white); display : flex}::placeholder { color : #ccc} |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
a { background : -webkit-linear-gradient(bottom, black, white); background : linear-gradient(to top, black, white); display : -webkit-box; display : -webkit-flex; display : -moz-box; display : -ms-flexbox; display : flex}:-ms-input-placeholder { color : #ccc}::-moz-placeholder { color : #ccc}::-webkit-input-placeholder { color : #ccc}::placeholder { color : #ccc} |
|
1
2
3
4
|
a { -webkit-border-radius : 5px; border-radius : 5px} |
|
1
2
3
|
a { border-radius : 5px} |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
Gruntfile.jsmodule.exports = function (grunt) { grunt .initConfig ({ autoprefixer : { dist : { files : { 'build/style.css' : 'style.css' } } }, watch : { styles : { files : ['style.css' ], tasks : ['autoprefixer' ] } } }); grunt.loadNpmTasks('grunt-autoprefixer' );grunt.loadNpmTasks('grunt-contrib-watch' );}; |
style.css 到 build/style.css. 同样我们将用 grunt-contrib-watch来监听style.css文件变化重新编译build/style.css。
|
1
2
3
|
a { width : calc(50% - 2em)} |
calc() 值单元需要Safari 6的浏览器前缀。|
1
2
3
4
|
a { width : -webkit-calc(50% - 2em); width : calc(50% - 2em)} |
|
1
2
3
4
|
a { width : calc(50% - 2em); transition : transform 1s} |
transition及transform 添加前缀。但IE9也需要为transform添加前缀,作为transition的值。
|
1
2
3
4
5
6
7
|
a { width : -webkit-calc(1% + 1em); width : calc(1% + 1em); -webkit-transition : -webkit-transform 1s; transition : -ms-transform 1s; transition : transform 1s} |
Autoprefixer:一个以最好的方式处理浏览器前缀的后处理程序的更多相关文章
- 转:[译]Autoprefixer:一个以最好的方式处理浏览器前缀的后处理程序
原文来自于:http://www.cnblogs.com/aNd1coder/archive/2013/08/12/3252690.html Autoprefixer解析CSS文件并且添加浏览器前缀到 ...
- [译]Autoprefixer:一个以最好的方式处理浏览器前缀的后处理程序
Autoprefixer解析CSS文件并且添加浏览器前缀到CSS规则里,使用Can I Use的数据来决定哪些前缀是需要的. 所有你需要做的就是把它添加到你的资源构建工具(例如 Grunt)并且可 ...
- 浏览器前缀-----[译]Autoprefixer:一个以最好的方式处理浏览器前缀的后处理程序
Autoprefixer解析CSS文件并且添加浏览器前缀到CSS规则里,使用Can I Use的数据来决定哪些前缀是需要的. 所有你需要做的就是把它添加到你的资源构建工具(例如 Grunt)并且可 ...
- Autoprefixer:一个以最好的方式处理浏览器前缀的后处理程序
Autoprefixer解析CSS文件并且添加浏览器前缀到CSS规则里,使用Can I Use的数据来决定哪些前缀是需要的. 所有你需要做的就是把它添加到你的资源构建工具(例如 Grunt)并且可 ...
- [译]Autoprefixer:用最可行的方式处理浏览器前缀的CSS后处理器
Autoprefixer,通过Can I Use数据库来确定哪些浏览器前缀是需要的,然后解析CSS文件,将前缀添加到CSS规则里. 你所要做的就是添加你的资源构建工具(比如:Grunt),然后你就可以 ...
- autoprefixer安装或者里sass的$mixin处理浏览器前缀
Autoprefixer是一个后处理程序,不象Sass以及Stylus之类的预处理器.它适用于普通的CSS,可以实现css3代码自动补全.也可以轻松跟Sass,LESS及Stylus集成,在CSS编译 ...
- 使用selenium时,使用从系统启动浏览器与通过自动化驱动方式启动浏览器控件ID不一样解决方法
最近遇到一个怪事,通过正常打开浏览器,按照正常的web登录然后点击进入系统流程,将各控件的ID识别成功,然后使用 python3+selenium写好脚本,高高兴兴的用脚本跑时老是提示找不到控件,然后 ...
- hbuilder和sublime的autoprefixer安装或者里sass的$mixin处理浏览器前缀
Autoprefixer是一个后处理程序,不象Sass以及Stylus之类的预处理器.它适用于普通的CSS,可以实现css3代码自动补全.也可以轻松跟Sass,LESS及Stylus集成,在CSS编译 ...
- [No000040]取得一个文本文件的编码方式
using System; using System.IO; using System.Text; /// <summary> /// 用于取得一个文本文件的编码方式(Encoding). ...
随机推荐
- spring一些总结
Spring中三种实例化bean的方法: 1)使用类构造器 <bean id="orderService" class="cn.itcast.OrderServ ...
- check source code after macro expand
Some time I'd like check source code after macro expand. We can use -E option to stop after the prep ...
- react 使用antd的多选功能做一个单选与全选效果
一个小而简单的单选全选功能,其实官网已经给出效果了,不过是我多做了些复合用法 addorupdatemodal.jsx import React from "react"; imp ...
- Codeforces 482B Interesting Array(线段树区间更新)
题目链接 Interesting Array 区间更新.然后对于每一个约数重新求一遍区间的&值,不符合就跳出. #include <bits/stdc++.h> using nam ...
- 转:GEF 英文全称Graphical Editor Framework
http://blog.csdn.net/chancein007/article/category/2713827
- Oracle数据库搭建
- pt-online-schema-change原理解析(转)
pt-online-schema-change原理解析 博客相关需要阅读 - zengkefu - 博客园 .pt-online-schema-change工具的使用限制: ).如果修改表有外键,除非 ...
- 从C的声明符到Objective-C的Blocks语法
原文链接:http://nilsou.com/blog/2013/08/21/objective-c-blocks-syntax/ 在这个post中,我先以C简单和内置复杂的声明开始,直到我们开始接触 ...
- 【ActiveMQ】管理界面查看消息详情,报错/WEB-INF/tags/form/forEachMapEntry.tag PWC6199: Generated servlet error: The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files
ActiveMQ版本:5.12 JDK版本:1.8 ===================== 使用ActiveMQ过程中,在管理界面查看消息详情,发现报错: 查看日志信息,报错如下: 2017-11 ...
- PathInterpolator
PathInterpolator 在v4 support library:Revision 22.1.0的时候,Google在兼容库中增加了几个新的类,用于创建更加真实的动画效果. Added the ...