日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > HTML >内容正文

HTML

解决各大浏览器兼容问题hack方法总结

發布時間:2024/1/17 HTML 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 解决各大浏览器兼容问题hack方法总结 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

解決各大瀏覽器兼容問題hack,IE6/ IE7/ IE8/ IE9/ Firefox/ Opera/ Webkit/ Chrome/ Safari.

方法一

1 color:red; /* 所有瀏覽器都支持 */ 2 color:red !important; /* 除IE6外 */ 3 _color:red; /* IE6支持 */ 4 *color:red; /* IE6、IE7支持 */ 5 +color:red; /*IE7支持*/ 6 *+color:red; /* IE7支持 */ 7 color:red\9; /* IE6、IE7、IE8、IE9支持 */ 8 color:red\; /* 針對所有IE */ 9 color:red\0; /* IE8、IE9支持 */ 10 color:red\9\0; /*IE9支持*/ 11 /* webkit and opera */ 12 @media all and (min-width: 0px){ div{color:red;} } 13 /* webkit */ 14 @media screen and (-webkit-min-device-pixel-ratio:0){ div{color:red;} } 15 /* opera */ 16 @media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel- 17 18 ratio:0) { div{color:red;} } 19 /* firefox * / 20 @-moz-document url-prefix(){ div{color:red;}} /* all firefox */ 21 22 html>/**/body div, x:-moz-any-link, x:default {color:red;} /* newest firefox */ 23 } 24 body:nth-of-type(1) p{color:red;} /* Chrome、Safari支持 */
方法二

<!--[if lt IE 7 ]> <html class="ie6"> <![endif]--> <!--[if IE 7 ]> <html class="ie7"> <![endif]--> <!--[if IE 8 ]> <html class="ie8"> <![endif]--> <!--[if IE 9 ]> <html class="ie9"> <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]--> <!–[if IE 7]> = 等于 IE7 <!–[if lt IE 8]> = 小于 IE8(就是 IE7 或以下了啦) <!–[if gte IE 8]> = 大于或等于 IE8 <meta http-equiv="x-ua-compatible" content="ie=7" /> 把這段代碼放到<head>里面,在ie8里面的頁面解析起來就跟ie7一模一樣的了 <!–[if IE]> <link rel=”stylesheet” href=”/ie-all.css” type=”text/css” media=”screen” /> <![endif]–><!–[if lt IE 8]> <link rel=”stylesheet” href=”/ie.css” type=”text/css” media=”screen” /> <![endif]–><!–[if IE 7]> <link rel=”stylesheet” href=”/ie7.css” type=”text/css” media=”screen” /> <![endif]–><!–[if IE 6]> <link rel=”stylesheet” href=”/ie6.css” type=”text/css” media=”screen” /> <![endif]–>
上面提到兩種解決各大
瀏覽器兼容問題的辦法,即:判斷瀏覽器針對不同瀏覽器寫不同的CSS文件和在同一個CSS文件中用各種瀏覽器的hack解決。兩種辦法各有利弊,選擇的時候應根據具體需要采用最適當的方法。

轉載于:https://www.cnblogs.com/xiaoyunxiao/archive/2012/04/03/2430958.html

總結

以上是生活随笔為你收集整理的解决各大浏览器兼容问题hack方法总结的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。