safari,google,firefox,opera css hack和js hack

CSS Hackweb

1. google和safari  (webkit內核)chrome

  @media screen and (-webkit-min-device-pixel-ratio:0){}app

 

2.firefox(Gecko內核)google

  /* Firefox 3.5+, IE 9/10, Opera */url

  @media screen and (min-resolution: +72dpi) {}spa

  /* Firefox 3.6+ */firefox

  @media screen and (-moz-images-in-menus:0) {}rest

  /* Firefox 4+ */get

  @media screen and (min--moz-device-pixel-ratio:0) {}it

  /* Firefox 3+ */

  @-moz-document url-prefix(){}

3.opera(Presto內核

  /* Opera 7 */

  @media all and (min-width: 0px){}

  /* Opera 12- */

  @media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0) {}  

  /* Opera, Firefox 3.5+, IE 9/10 */
  @media screen and (min-resolution: +72dpi) {}

4.ie()

/* IE 6/7 */
@media screen\9 {}

/* IE 6/7/8 */
@media \0screen\,screen\9 {}

/* IE 8 */
@media \0screen {}

/* IE 8/9/10 & Opera */
@media screen\0 {}

/* IE 9/10, Firefox 3.5+, Opera */
@media screen and (min-resolution: +72dpi) {}

/* IE 9/10 */}

/* IE 10+ */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {}

/* Everything but IE 6/7/8 */
@media screen and (min-width: 400px) {}

 

JS Hack


1.google

var isChrome = Boolean(window.chrome);

2.safari

/* Safari */
var isSafari = /a/.__proto__=='//';

3.firefox

/* Firefox */
var isFF = !!navigator.userAgent.match(/firefox/i);

/* Firefox 2 - 13 */
var isFF = Boolean(window.globalStorage);

/* Firefox 2/3 */
var isFF = /a/[-1]=='a';

/* Firefox 3 */
var isFF = (function x(){})[-5]=='x';

4.opera

/* Opera 9.64- */
var isOpera = /^function \(/.test([].sort);

/* Opera 12- */
var isOpera = Boolean(window.opera);

 

5.ie

/* IE <= 8 */var isIE = '\v'=='v'; /* IE 6 */(checkIE = document.createElement("b")).innerHTML = "<!--[if IE 6]><i></i><![endif]-->"; var isIE = checkIE.getElementsByTagName("i").length == 1; /* IE 7 */(checkIE = document.createElement("b")).innerHTML = "<!--[if IE 7]><i></i><![endif]-->"; var isIE = checkIE.getElementsByTagName("i").length == 1;navigator.appVersion.indexOf("MSIE 7.")!=-1 /* IE 8 */(checkIE = document.createElement("b")).innerHTML = "<!--[if IE 8]><i></i><![endif]-->"; var isIE = checkIE.getElementsByTagName("i").length == 1; /* IE 9 */(checkIE = document.createElement("b")).innerHTML = "<!--[if IE 9]><i></i><![endif]-->"; var isIE = checkIE.getElementsByTagName("i").length == 1; /* IE 10 */var isIE = eval("/*@cc_on!@*/false") && document.documentMode === 10; /* IE 10 */var isIE = document.body.style.msTouchAction != undefined;

相關文章
相關標籤/搜索