通過CSS Hack 區分 FF/IE7/IE6/IE5.5/IE5 代碼推薦_經驗交流

來源:互聯網
上載者:User
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>通過CSS Hack 區分 FX/IE7/IE6/IE5.5/IE5</title> <style type="text/css"> <!-- #fx { display: none; border: 3px double #999; width:300px; height:200px; padding:10px; } #ie6{ display:none !important; display:none;/*ie5*/ font-size:54px; border:10px solid #CCC; padding:100px; } #ie6/**/{ display:block; display /*ie5.5*/:none; } #ie7 { display:block !important; display:none;/*ie5 & ie6*/ background-color:#69f; border:1px dashed #63c; padding:50px; width:200px; height:150px; } *:lang(zh) #ie7{ display:none !important; } *:lang(zh) #fx{ display:block !important; } --> #example{color:red ;} * html #example{color:blue;} *+html #example{color:green;} </style> </head> <body lang="zh"> 這是在 FireFox 或者 Opera 下面的效果 這是在 IE 6 下面的效果 這是在 IE 7 下面的效果 以下為簡單區分FF/IE6/IE7樣本 這行文字在FF下應為紅色,在IE6下應為藍色,在IE7下應為綠色。 </body> </html>
[Ctrl+A 全選 注:如需引入外部Js需重新整理才能執行]
  • 相關文章

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.