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). ...
随机推荐
- jQuery基础 浅析(含基本方法和选择器)
1.jQuery与DOM互相转换 jQuery入库函数:$(document).ready(function(){}) $(function(){}) $(“#btn”):jQuery存储的是DOM对 ...
- 洛谷 [P3381] 最小费用最大流模版
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #i ...
- DFA NFA
如果不用 DFA, NFA,我觉得也是可以处理编译过程的,一个字符一个字符的读入,并结合上下文,来确定 token
- 存储过程中set什么什么的讲解
原文发布时间为:2008-09-27 -- 来源于本人的百度文章 [由搬家工具导入] set ansi_nulls [on/off] 与 set quoted_identifier [on/off] ...
- unused function warning message
這篇的對象是 static function, static function 若沒有其它 function 去存取的話, 在 compile 時,會發生 unused error, 可以在 func ...
- 用C#将XML转换成JSON
本文旨在介绍如果通过C#将获取到的XML文档转换成对应的JSON格式字符串,然后将其输出到页面前端,以供JavaScript代码解析使用.或许你可以直接利用JavaScript代码通过Ajax的方式来 ...
- Codeforces Round #451 (Div. 2) A. Rounding【分类讨论/易错】
A. Rounding time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
- 安全性测试入门 (四):Session Hijacking 用户会话劫持的攻击和防御
本篇继续对于安全性测试话题,结合DVWA进行研习. Session Hijacking用户会话劫持 1. Session和Cookies 这篇严格来说是用户会话劫持诸多情况中的一种,通过会话标识规则来 ...
- svn报“Previous operation has not finished; run 'cleanup' if it was interrupted”的错误
-.叙述 今天需要更新接口文檔,所以就update了一下,結果報了如下錯誤: Error : Previous operation has not finished; run 'cleanu ...
- java的架构流行阶段
第一阶段:SSM 第二阶段:分布式系统改造,平台化初具规模,各项垂直业务系统搭建上线.产品端极大丰富用户投资.大数据平台研究并使用 第三阶段:SOA治理,使用zookeeper作为注册中心,dubbo ...