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). ...
随机推荐
- 使用docker-maven-plugin插件构建docker镜像(已过时)
可以参考博客:https://blog.csdn.net/aixiaoyang168/article/details/77453974 docker-maven-plugin官网推荐在新项目中使用do ...
- jsonp 格式
jQuery(document).ready(function(){ $.ajax({ type: "get", async: false, url: "http://f ...
- js判断手机的左右滑动
js代码 $(function() { function judge() { var startx;//让startx在touch事件函数里是全局性变量. var endx; var el = doc ...
- 转 C++的常量引用
C++的常量引用 如果是对一个常量进行引用,则编译器首先建立一个临时变量,然后将该常量的值置入临时变量中,对该引用的操作就是对该临时变量的操作.对常量的引用可以用其它任何引用来初始化:但不能改变. 关 ...
- 【Linux】自主实现my_sleep【转】
转自:http://blog.csdn.net/scenlyf/article/details/52068522 版权声明:本文为博主原创文章,未经博主允许不得转载. 首先说一下信号相关的内容. ** ...
- hexo添加百度统计
litten的主题yilia 编辑文件 themes/yilia/_config.yml,添加一行配置,可以删除原来的google analytics baidu_tongji: true 新建 th ...
- HashMap之equals和hashCode小陷阱
先以一段代码开始这篇blog. 01 public class Name { 02 03 private String first; //first name 04 private Str ...
- Scala之Future超时
最近在开发中使用akka http进行请求,返回的是一个future,并且要对future进行超时设置,不知怎么设置,因此学习了下. 一.Future阻塞 首先,scala中的future不支持内置超 ...
- NOI模拟题5 Problem A: 开场题
Solution 注意到\(\gcd\)具有结合律: \[ \gcd(a, b, c) = \gcd(a, \gcd(b, c)) \] 因此我们从后往前, 对于每个位置\(L\), 找到每一段不同的 ...
- workflow engine Ruote初体验之二(通用属性)
罗列一下表达式所支持的属性: :timeout :if/ unless :forget :lose :flank :on_error :on_cancel :on_timeout :tag :filt ...