码迷,mamicode.com
首页 > 其他好文 > 详细

浏览器兼容性问题

时间:2015-09-19 09:41:31      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:

我目前遇到的各个浏览器兼容性问题

1.ie6/7/8border-radiu属性。解决办法:backgroundsize.htc、backgroundsize.min.htc,可以缓解模拟圆角。

2.ie6不识别透明属性。解决办法:DD_belatedPNG_jb51.net,js加载文件。

3.谷歌竟然和Safari有时显示不一样。用到了hack,具体如下:

  1. <!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]--> 
      2. <!--[if IE]> 所有的IE可识别 <![endif]--> 
  3. <!--[if IE 5.0]> 只有IE5.0可以识别 <![endif]--> 
  4. <!--[if IE 5]> 仅IE5.0与IE5.5可以识别 <![endif]--> 
  5. <!--[if gt IE 5.0]> IE5.0以及IE5.0以上版本都可以识别 <![endif]--> 
  6. <!--[if IE 6]> 仅IE6可识别 <![endif]--> 
  7. <!--[if lt IE 6]> IE6以及IE6以下版本可识别 <![endif]--> 
  8. <!--[if gte IE 6]> IE6以及IE6以上版本可识别 <![endif]--> 
  9. <!--[if IE 7]> 仅IE7可识别 <![endif]--> 
  10. <!--[if lt IE 7]> IE7以及IE7以下版本可识别 <![endif]--> 
  11. <!--[if gte IE 7]> IE7以及IE7以上版本可识别 <![endif]--> 

  12.区分谷歌和Safari的jq

$(document).ready(function(){
//那段代码
var userAgent = navigator.userAgent.toLowerCase();
$.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());

// Is this a version of Chrome?
if($.browser.chrome){
userAgent = userAgent.substring(userAgent.indexOf(‘chrome/‘) +7);
userAgent = userAgent.substring(0,userAgent.indexOf(‘.‘));
$.browser.version = userAgent;
// If it is chrome then jQuery thinks it‘s safari so we have to tell it it isn‘t
$("#ggsb").addClass("chrome");
}

// Is this a version of Safari?
if($.browser.safari){
userAgent = userAgent.substring(userAgent.indexOf(‘version/‘) +8);
userAgent = userAgent.substring(0,userAgent.indexOf(‘.‘));
$.browser.version = userAgent;
}
});

</script>

.chorme{}
.safari{}

【FireFox】

@-moz-document url-prefix(){.className{color:#FFF}}

【webkit内核:safari chrome】

@media screen and (-webkit-min-device-pixel-ratio:0){.className{color:#FFF}}

【presto内核:opera】

@media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0){head~body .className{color:#FFF}

浏览器兼容性问题

标签:

原文地址:http://www.cnblogs.com/BBYY/p/4820892.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!