各种奇妙的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表示元素名:①[ ...
随机推荐
- OPPO A7X 刷机小结
OPPO A7X 刷机小结: 概述:根据网上找到的教程(MTK模式刷机教程),没有成功.在QQ上询问一位提供刷机服务的大神,说是只有老版本才能刷. 操作步骤: 刷机工具: MediaTek SP Fl ...
- shellcode 初次使用笔记
winXP SP3 环境 (xp环境默认没开启栈不可执行机制,比较方便破解,如果已开启了,请自行百度如何关闭) dig.exe 目标文件 x86dbg调试工具 python 环境 打开准备好的目标软件 ...
- B1041. 考试座位号(15)
这题比较简单,没有调试,一次通过,虽然简单,不过也有借鉴意义. #include<bits/stdc++.h> using namespace std; const int N=1005; ...
- Mabatis中#{}和${}的区别
动态 sql 是 mybatis 的主要特性之一,在 mapper 中定义的参数传到 xml 中之后,在查询之前 mybatis 会对其进行动态解析.mybatis 为我们提供了两种支持动态 sql ...
- 《Linux内核分析》第三周学习报告
<Linux内核分析>第三周学习报告 ——构造一个简单的Linux系统MenuOS 姓名:王玮怡 学号:201351 ...
- 《Linux内核设计与实现》第五周读书笔记——第十一章
<Linux内核设计与实现>第五周读书笔记——第十一章 20135301张忻 估算学习时间:共2.5小时 读书:2.0 代码:0 作业:0 博客:0.5 实际学习时间:共3.0小时 读书: ...
- # linux读书笔记(3章)
linux读书笔记(3章) 标签(空格分隔): 20135328陈都 第三章 进程管理 3.1 进程 进程就是处于执行期的程序(目标码存放在某种存储介质上).但进程并不仅仅局限于一段可执行程序代码( ...
- Python Pandas read_csv报错
为实现文本去重(将前面采集的数据进行两两对比删除重复),写了以下代码. #-*- coding: utf-8 -*-import pandas as pd inputfile = 'e:/data/H ...
- Arduino与Air800开发板使用UART通信:传输DHT22传感器数据
硬件介绍 Arduino Leonardo在数字引脚0(RX)和1(TX)进行串口通信时是使用“Serial1”,USB的串口通信使用的是“Serial”.在数字引脚0(RX)和1(TX)与USB是相 ...
- 一日游 + 进度psp
假设我们全班同学及教师去吉林省吉林市1日游,请为这次活动给出规格说明书. 目录 1 引言 1.1 编写目的 1.2 项目背景 1.3 参考资料 2 需求分析 2.1 交通方式 ...