各种奇妙的hack
Chrome
Selector Hacks
Supports Hacks
Property/Value Hacks
.selector { (;property: value;); }.selector { [;property: value;]; }
- Chrome ≤ 28
- Safari ≤ 7
- Opera ≥ 14
JavaScript Hacks
Webkit
var isWebkit = 'WebkitAppearance' in document.documentElement.style;
- Chrome *
- Safari ≥ 3
- Opera ≥ 14
Media Query Hacks
@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm) { .selector {} }
- Chrome ≥ 29
- Opera ≥ 16
Firefox
Selector Hacks
Everything but Firefox and Internet Explorer ≤8
_::selection, .selector:not([attr*='']) {}
- Internet Explorer ≤ 8
- firefox *
Supports Hacks
@supports (-moz-appearance:meterbar) and (background-blend-mode:difference,normal) {}
- firefox ≥ 30
JavaScript Hacks
Media Query Hacks
@media all and (min--moz-device-pixel-ratio:0) and (min-resolution: .001dpcm) {}@media all and (-moz-images-in-menus:0) and (min-resolution: .001dpcm) {}
- firefox ≥ 8
@media all and (min--moz-device-pixel-ratio:0) { @media (min-width: 0px) {} }@media all and (-moz-images-in-menus:0) { @media (min-width: 0px) {} }
- firefox ≥ 11
Miscellaneous
Internet Explorer
Selector Hacks
.unused-class can be any unused class
* html .selector {}.unused-class.selector {}
- Internet Explorer ≤ 6
*:first-child+html .selector {}.selector, x:-IE7 {}*+html .selector {}body*.selector {}
- Internet Explorer 7
Everything but Internet Explorer ≤7
html > /**/ body .selector {}head ~ /**/ body .selector {}
- Internet Explorer ≤ 7
Everything but Firefox and Internet Explorer ≤8
_::selection, .selector:not([attr*='']) {}
- Internet Explorer ≤ 8
- firefox *
Everything but Internet Explorer ≤8
:root .selector {}body:last-child .selector {}body:nth-of-type(1) .selector {}body:first-of-type .selector {}.selector:not([attr*='']) {}
- Internet Explorer ≤ 8
Property/Value Hacks
Any combination of these characters: ! $ & * ( ) = % + @ , . / ` [ ] # ~ ? : < > |
.selector { !property: value; }.selector { $property: value; }.selector { &property: value; }.selector { *property: value; }.selector { )property: value; }.selector { =property: value; }.selector { %property: value; }.selector { +property: value; }.selector { @property: value; }.selector { ,property: value; }.selector { .property: value; }.selector { /property: value; }.selector { `property: value; }.selector { ]property: value; }.selector { #property: value; }.selector { ~property: value; }.selector { ?property: value; }.selector { :property: value; }.selector { |property: value; }
- Internet Explorer ≤ 7
Acts as an !important; string after ! can be anything
.selector { property: value !ie; }
- Internet Explorer ≤ 7
JavaScript Hacks
Check for Internet Explorer version
var ieVersion = /*@cc_on (function() {switch(@_jscript_version) {case 1.0: return 3; case 3.0: return 4; case 5.0: return 5; case 5.1: return 5; case 5.5: return 5.5; case 5.6: return 6; case 5.7: return 7; case 5.8: return 8; case 9: return 9; case 10: return 10;}})() || @*/ 0;
- Internet Explorer 3-10
var isIE = document.all && document.querySelector && !document.addEventListener;
- Internet Explorer 8
Check for Internet Explorer version
var ieVersion = (function() { if (new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})").exec(navigator.userAgent) != null) { return parseFloat( RegExp.$1 ); } else { return false; } })();
- Internet Explorer ≤ 10
var isIE = 'behavior' in document.documentElement.style && '-ms-user-select' in document.documentElement.style;
- Internet Explorer 10
var isIE = '-ms-scroll-limit' in document.documentElement.style && '-ms-ime-align' in document.documentElement.style;
- Internet Explorer 11
Media Query Hacks
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {}
- Internet Explorer ≥ 10
Everything but Internet Explorer and Safari ≤6
@media screen { @media (min-width: 0px) {} }
- Internet Explorer *
- Safari ≤ 6
Conditional comments
<!--[if IE 6]> Internet Explorer 6 <![endif]--><!--[if IE 7]> Internet Explorer 7 <![endif]--><!--[if IE 8]> Internet Explorer 8 <![endif]--><!--[if IE 9]> Internet Explorer 9 <![endif]-->
- Internet Explorer 6-9
<!--[if lte IE 6]> Internet Explorer 6 or less <![endif]--><!--[if lte IE 7]> Internet Explorer 7 or less <![endif]--><!--[if lte IE 8]> Internet Explorer 8 or less <![endif]--><!--[if lte IE 9]> Internet Explorer 9 or less <![endif]-->
- Internet Explorer 6-9
<!--[if gte IE 6]> Internet Explorer 6 or greater <![endif]--><!--[if gte IE 7]> Internet Explorer 7 or greater <![endif]--><!--[if gte IE 8]> Internet Explorer 8 or greater <![endif]--><!--[if gte IE 9]> Internet Explorer 9 or greater <![endif]-->
- Internet Explorer 6-9
Everything but Internet Explorer ≤9
<!--[if !IE]><!--> Everything but Internet Explorer ≤9 <!--<![endif]-->
- Internet Explorer ≤ 9
Opera
Selector Hacks
@media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0) {}
- Opera ≤ 11
Supports Hacks
Property/Value Hacks
.selector { (;property: value;); }.selector { [;property: value;]; }
- Chrome ≤ 28
- Safari ≤ 7
- Opera ≥ 14
JavaScript Hacks
Webkit
var isWebkit = 'WebkitAppearance' in document.documentElement.style;
- Chrome *
- Safari ≥ 3
- Opera ≥ 14
Media Query Hacks
@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm) { .selector {} }
- Chrome ≥ 29
- Opera ≥ 16
Opera Mini
JavaScript Hacks
var isOperaMini = Object.prototype.toString.call(window.operamini) === '[object OperaMini]';
- Opera Mini *
Safari
Selector Hacks
Property/Value Hacks
.selector { (;property: value;); }.selector { [;property: value;]; }
- Chrome ≤ 28
- Safari ≤ 7
- Opera ≥ 14
JavaScript Hacks
Webkit
var isWebkit = 'WebkitAppearance' in document.documentElement.style;
- Chrome *
- Safari ≥ 3
- Opera ≥ 14
var isSafari = !!navigator.userAgent.match(/safari/i) && !navigator.userAgent.match(/chrome/i) && typeof document.body.style.webkitFilter !== "undefined" && !window.chrome;
- Safari 6
Media Query Hacks
Everything but Internet Explorer and Safari ≤6
@media screen { @media (min-width: 0px) {} }
- Internet Explorer *
- Safari ≤ 6
各种奇妙的hack的更多相关文章
- 转载:移动web开发规范
本文来源:http://blog.csdn.net/joueu/article/details/44329825 以下是规范建议,均是日常在开发当中的的一些经验,仅供参考. 移动web开发规范 一.头 ...
- html5手机常见问题与工具分享
mobileTech A useful tools or tips list for mobile web application developing 这个项目收集移动端开发所需要的一些资源与小技巧 ...
- mobileTech
A useful tools or tips list for mobile web application developing 这个项目收集移动端开发所需要的一些资源与小技巧 工具类网站 HTML ...
- (任寒韬)WebApp群主 - MobileTech 资料
web app : http://www.lightapp.cn/brand/index/4101 https://github.com/jtyjty99999/mobileTech/blob/mas ...
- mobilehack -转
# mobileHack##工具类网站 [HTML5 与 CSS3 技术应用评估](http://html5please.com/ "html5与css3技术应用评估") [各种奇 ...
- frontend-tools
收集整理好用的前端开发利器(Collect good front-end development tools ) 1.w3cplus前端工具 2.jsfiddle在线JS代码调试工具 3.w3cfun ...
- 移动Web解决方案的链接收藏
信息类 html5 浏览器兼容性查询 - 浏览器内建对象文档 es5规范浏览器兼容性表格 es6规范浏览器兼容性表格 stackoverflow 最靠谱的问题解决方案 github 开源代码网站 全球 ...
- css常用hack
原文地址:css常用hack 突然想起今天早上在CNZZ看到的统计数据,使用IE6.7的用户比例还真多,看到之后我的心都碎了.微软都放弃了为毛还有这么多人不死心? 所以说,IE下的兼容还是得做的. – ...
- CSS3_01之选择器、Hack
1.兄弟选择器:①相邻兄弟选择器:元素的后一个兄弟元素,选择器1+选择器2:②通用兄弟选择器:元素后的所有兄弟元素,选择器1~选择器2: 2.属性选择器:attr表示属性名称,elem表示元素名:①[ ...
随机推荐
- jquery自动获取项目url路径
//很多时候我们需要使用当前项目路径,但是如果把项目路径写死,会带来很多不便,此时就需要自动获取项目路径.//我们可以根据jquery来进行自动获取项目路径,获取方法如下function getRoo ...
- 如何自出版一本书:定制 bookdown
目录 如何自出版一本书:定制 bookdown bookdown 的第一步 亚马逊 Kindle 格式 创建书籍 _bookdown.yml 注意行宽 写在每个 .Rmd 文件的开头 index.Rm ...
- SQL邮件服务(解决各种疑难杂症)+案例 + 使用SQLserver 邮件系统发送SQL代理作业执行警告
首先你需要知道你要做的几部: 1 每个数据库都有自己的 SERVICE BROKER 很多SQL SERVER内部服务依赖它 2 启动 SERVICE BROKER 需要 1 STOP 你的 SQL ...
- Daily Scrumming* 2015.12.12(Day 4)
一.团队scrum meeting照片 二.今日总结 姓名 WorkItem ID 工作内容 签入链接以及备注说明 江昊 任务1036 进行界面开发,明日准备开发第一个界面,社团展示界面 工作暂未完 ...
- Daily Scrumming* 2015.12.8(Day 1)
一.团队scrum meeting照片 二.今日总结 姓名 WorkItem ID 工作内容 签入链接以及备注说明 江昊 任务942 学习使用github,在github上建立组织并将所有队员纳入, ...
- 20135220谈愈敏Blog5_系统调用(下)
系统调用(下) 谈愈敏 原创作品转载请注明出处 <Linux内核分析>MOOC课程 http://mooc.study.163.com/course/USTC-1000029000 给Me ...
- 编写JDBC框架:(策略设计模式)
package com.itheima.domain; //一般:实体类的字段名和数据库表的字段名保持一致 //约定优于编码 public class Account { private int id ...
- File类操作文件
简单示例: public static void main(String[] args) { // 列出系统所有的根路径 File[] listRoots = File.listRoots(); fo ...
- final版本发布评价II
其实我对技术上的问题了解不多,所以有些评语可能说的不对或者压根就没啥用.可直接忽略.请见谅. 1新蜂的俄罗斯方块,UI设计虽然给出了背景和颜色,但是感觉色彩对比也不好,模块之间也不协调.没有更多的说服 ...
- 打包spring项目遇到的坑 Unable to locate Spring NamespaceHandler for XML schema ……shcema/context 产生的原因及解决方法
图1 图2 问题原因:导致该问题的原因就是打包的时候,同时将 spring-context 和 spring-aop包提取到了我们的程序应用的包中,在package过程中,这2个依赖包的 XML sc ...