2014-10-02 65 views
0

如何在html中強制使用IE9 css樣式。HTML:如何強制IE11在HTML中模擬IE9?

我用這個代碼

<script runat="server"> 
     private void Page_PreRender(object sender, EventArgs e) 
     { 
      var meta = new HtmlMeta(); 
      meta.Content = "IE=EmulateIE9"; 
      meta.HttpEquiv = "X-UA-Compatible"; 
      this.Page.Header.Controls.AddAt(0, meta); 
     } 
</script> 

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9"> 

要獲得相同stylres是所有版本的Internet Explorer時,以IE9爲標準。

我這樣做代碼:

<!--[if IE]> 
     <link rel="stylesheet" type="text/css" href="~/App_Themes/CocktailSite/master-interno-ie.css" media="screen" /> 
    <!--[else]> 
     <link rel="stylesheet" type="text/css" href="~/App_Themes/CocktailSite/master-interno.css" media="screen" /> 
<![endif]--> 

,它正在爲IE9時,採取主INTERNO-ie.css但在IE11採用主INTERNO。

我一直在這裏回答所有的答案,並沒有在我的情況下工作。

+1

的還有,如果是無關緊要的,因爲你包括相同的文件。 – TheFrozenOne 2014-10-02 08:30:04

+0

我的X-UA兼容metatag在 – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/3451964/">David</a></span> <span>2014-10-02 08:30:17</span> </small> </span> </p> </div> </div> </div> <div itemprop="comment" class="post-comment"> <div class="row"> <div class="col-lg-1"><span class="text-secondary">+0</span></div> <div class="col-lg-11"> <p class="commenttext">doodlebunch我該怎麼做呢?在兩個如果? – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/3451964/">David</a></span> <span>2014-10-02 08:30:56</span> </small> </span> </p> </div> </div> </div> </div> </div> </article> </div> <div class="answer-title"> <span class="text-logo margin-top-sm">A</span> <h2 class="title h4">回答</h2> </div> <div class="item-description text-md markdown-body margin-bottom-40 voidso"> <article class="board-top-1 padding-top-10"> <div class="post-col vote-info"> <span class="count">0<i class="fa fa-thumbs-up"></i></span> </div> <div class="post-offset"> <div class="answer fmt"> <p><a href="http://msdn.microsoft.com/en-us/library/ms537512%28v=vs.85%29.aspx" rel="nofollow">IE no longer evaluates conditional HTML comments</a>。</p> <blockquote> <p><strong>如Internet Explorer 10</strong>,條件註釋不再 通過標準模式下支持。使用功能檢測爲瀏覽器支持的非網站功能 提供 有效的回退策略。</p> </blockquote> </div> <div class="post-info"> <div class="post-meta row"> <p class="text-secondary col-lg-6"> <span class="source"> <a rel="noopener" target="_blank" href="https://stackoverflow.com/q/26157069">來源</a> </span> </p> <p class="text-secondary col-lg-6"> <span class="float-right date"> <span>2014-10-02 08:31:45</span> </p> <p class="col-12"></p> <p class="col-12"></p></div> </div> <!-- comments --> <div class="comments"> <div itemprop="comment" class="post-comment"> <div class="row"> <div class="col-lg-1"><span class="text-secondary">+0</span></div> <div class="col-lg-11"> <p class="commenttext">我正在看你在這裏添加的鏈接和該鏈接不認識ie11 – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/3451964/">David</a></span> <span>2014-10-02 08:42:04</span> </small> </span> </p> </div> </div> </div> </div> </div> </article> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1038284119" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <article class="board-top-1 padding-top-10"> <div class="post-col vote-info"> <span class="count">0<i class="fa fa-thumbs-up"></i></span> </div> <div class="post-offset"> <div class="answer fmt"> <p>我使用jQuery。</p> 腳本和紐帶 <p>我這個編碼:</p> <pre><code class="prettyprint-override">function isIE() { var sAgent = window.navigator.userAgent; var Idx = sAgent.indexOf("MSIE"); // If IE, return version number. if (Idx > 0) return true; // If IE 11 then look for Updated user agent string. else if (!!navigator.userAgent.match(/Trident\/7\./)) return true; else return false; //It is not IE } </code></pre> <p>後它,我交鋒:</p> <pre><code class="prettyprint-override">if (isIE()) { jQuery('head').append('<link rel="stylesheet" type="text/css" href="~/App_Themes/CocktailSite/master-interno-ie.css" media="screen" />'); } </code></pre> <p>,它正在爲我的neededs。</p> <p>檢測過的所有IE版本,Chrome和Firefox</p> </div> <div class="post-info"> <div class="post-meta row"> <p class="text-secondary col-lg-6"> <span class="source"> <a rel="noopener" target="_blank" href="https://stackoverflow.com/q/26161594">來源</a> </span> </p> <p class="text-secondary col-lg-6"> <span class="float-right date"> <span>2014-10-02 13:09:26</span> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/3451964/">David</a></span> </p> <p class="col-12"></p> <p class="col-12"></p></div> </div> </div> </article> </div> <div class="clearfix"> </div> <div class="relative-box"> <div class="relative">相關問題</div> <ul class="relative_list"> <li> 1. <a href="http://hk.uwenku.com/question/p-mqammlks-hr.html" target="_blank" title="模擬在IE11"> 模擬在IE11 </a> </li> <li> 2. <a href="http://hk.uwenku.com/question/p-zzheyjex-bcx.html" target="_blank" title="如何強制IE9在IE9文檔模式下渲染?"> 如何強制IE9在IE9文檔模式下渲染? </a> </li> <li> 3. <a href="http://hk.uwenku.com/question/p-ujbgoeiv-bca.html" target="_blank" title="如何在HTML中模擬列表?"> 如何在HTML中模擬列表? </a> </li> <li> 4. <a href="http://hk.uwenku.com/question/p-mbtjujfu-ue.html" target="_blank" title="在IE9中強制兼容模式"> 在IE9中強制兼容模式 </a> </li> <li> 5. <a href="http://hk.uwenku.com/question/p-xgdrnqkk-vk.html" target="_blank" title="如何讓IE9模擬IE7?"> 如何讓IE9模擬IE7? </a> </li> <li> 6. <a href="http://hk.uwenku.com/question/p-mbqfrtoa-va.html" target="_blank" title="如何在Ie9中禁用HTML Html按鈕的藍色發光"> 如何在Ie9中禁用HTML Html按鈕的藍色發光 </a> </li> <li> 7. <a href="http://hk.uwenku.com/question/p-kxkhyhce-nr.html" target="_blank" title="如何在HTML中爲IE9製作四捨五入的邊框"> 如何在HTML中爲IE9製作四捨五入的邊框 </a> </li> <li> 8. <a href="http://hk.uwenku.com/question/p-xidbhnyg-bob.html" target="_blank" title="如何強制ie11請求新的favicon?"> 如何強制ie11請求新的favicon? </a> </li> <li> 9. <a href="http://hk.uwenku.com/question/p-sglhhzsz-ns.html" target="_blank" title="HTML模擬在文本框"> HTML模擬在文本框 </a> </li> <li> 10. <a href="http://hk.uwenku.com/question/p-vxmjehbw-gq.html" target="_blank" title="如何強制樣式HTML元素?"> 如何強制樣式HTML元素? </a> </li> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block; text-align:center;" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-6208739752673518" data-ad-slot="4606349252"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <li> 11. <a href="http://hk.uwenku.com/question/p-wwgcyfxu-sc.html" target="_blank" title="html/css/pre/code:如何強制回車"> html/css/pre/code:如何強制回車 </a> </li> <li> 12. <a href="http://hk.uwenku.com/question/p-wgvfdzic-tu.html" target="_blank" title="如何強制HttpClient獲取純html?"> 如何強制HttpClient獲取純html? </a> </li> <li> 13. <a href="http://hk.uwenku.com/question/p-rubfkmch-nn.html" target="_blank" title="如何強制BeautifulSoup輸出HTML實體"> 如何強制BeautifulSoup輸出HTML實體 </a> </li> <li> 14. <a href="http://hk.uwenku.com/question/p-enynknzm-ut.html" target="_blank" title="如何強制HTML元素成一行?"> 如何強制HTML元素成一行? </a> </li> <li> 15. <a href="http://hk.uwenku.com/question/p-fosrbxaa-bck.html" target="_blank" title="IE9:強制IE9瀏覽器模式和文檔模式"> IE9:強制IE9瀏覽器模式和文檔模式 </a> </li> <li> 16. <a href="http://hk.uwenku.com/question/p-dsqsafab-pu.html" target="_blank" title="document.ready()模擬$(html)/ $。ajax"> document.ready()模擬$(html)/ $。ajax </a> </li> <li> 17. <a href="http://hk.uwenku.com/question/p-gbijthym-bab.html" target="_blank" title="流HTML不IE9"> 流HTML不IE9 </a> </li> <li> 18. <a href="http://hk.uwenku.com/question/p-eqswntln-beq.html" target="_blank" title="在HTML中強制TR高度"> 在HTML中強制TR高度 </a> </li> <li> 19. <a href="http://hk.uwenku.com/question/p-gsejjvqg-py.html" target="_blank" title="PHP vs SSI在html強制環境中"> PHP vs SSI在html強制環境中 </a> </li> <li> 20. <a href="http://hk.uwenku.com/question/p-rhsdlqjs-zb.html" target="_blank" title="在Asp.Net中強制關閉HTML標記"> 在Asp.Net中強制關閉HTML標記 </a> </li> <li> 21. <a href="http://hk.uwenku.com/question/p-asmeyhib-bgg.html" target="_blank" title="CSS/HTML:如何用CSS模擬IFRAME?"> CSS/HTML:如何用CSS模擬IFRAME? </a> </li> <li> 22. <a href="http://hk.uwenku.com/question/p-orvtqvhi-bce.html" target="_blank" title="在Android中模擬HTML表單"> 在Android中模擬HTML表單 </a> </li> <li> 23. <a href="http://hk.uwenku.com/question/p-eqbagsul-bar.html" target="_blank" title="用於html innerHTML的jquery模擬HTML + ="> 用於html innerHTML的jquery模擬HTML + = </a> </li> <li> 24. <a href="http://hk.uwenku.com/question/p-gdsxsusi-bcv.html" target="_blank" title="IE11到IE9兼容模式的JavaScript"> IE11到IE9兼容模式的JavaScript </a> </li> <li> 25. <a href="http://hk.uwenku.com/question/p-oiboenfj-ov.html" target="_blank" title="在IE10中強制HTML頁面使用IE Quirks模式"> 在IE10中強制HTML頁面使用IE Quirks模式 </a> </li> <li> 26. <a href="http://hk.uwenku.com/question/p-uvuixlfb-bgm.html" target="_blank" title="如何在android模擬器中刪除強制關閉錯誤?"> 如何在android模擬器中刪除強制關閉錯誤? </a> </li> <li> 27. <a href="http://hk.uwenku.com/question/p-kmddtaml-hu.html" target="_blank" title="如何在groovy中使用映射強制來模擬java.util.Map?"> 如何在groovy中使用映射強制來模擬java.util.Map? </a> </li> <li> 28. <a href="http://hk.uwenku.com/question/p-tpnmptgo-xc.html" target="_blank" title="如何強制在IIS 7+中不使用模擬?"> 如何強制在IIS 7+中不使用模擬? </a> </li> <li> 29. <a href="http://hk.uwenku.com/question/p-yriopqul-tx.html" target="_blank" title="GWT IE9模擬IE8"> GWT IE9模擬IE8 </a> </li> <li> 30. <a href="http://hk.uwenku.com/question/p-ccmclflo-bcc.html" target="_blank" title="如何在GraphViz html-like標籤中強制「無樣條」?"> 如何在GraphViz html-like標籤中強制「無樣條」? </a> </li> </ul> </div> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1575177025"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="padding-top-10"></div> </div> </div> <script type="text/javascript" src="http://img.uwenku.com/uwenku/script/side.js?t=1644592048261"></script> <script type="text/javascript" src="http://img.uwenku.com/uwenku/plugin/highlight/highlight.pack.js"></script> <link href="http://img.uwenku.com/uwenku/plugin/highlight/styles/docco.css" media="screen" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $('pre').each(function(i, e) { hljs.highlightBlock(e, "<span class='indent'> </span>", false) }); </script> <div class="col-lg-3 col-md-4 col-sm-5"> <div id="rightTop"> <div class="row"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="5415218910" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="row sidebar panel panel-default"> <div class="panel-heading font-bold"> 最新問題 </div> <div class="m-b-sm m-t-sm clearfix"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-fkkjwjzq-qt.html" target="_blank" title="多層次按菜單角4"> 多層次按菜單角4 </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-csctcjgp-rc.html" target="_blank" title="Yodlee providerAccounts REST端點憑證"> Yodlee providerAccounts REST端點憑證 </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-qgmmappj-ro.html" target="_blank" title="體面性能Gem5系統要求"> 體面性能Gem5系統要求 </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-dfaghluo-rx.html" target="_blank" title="熊貓:從行的特定列中選擇值"> 熊貓:從行的特定列中選擇值 </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-zeeftwxs-pp.html" target="_blank" title="Bypass Itunes Connect Testflight應用程序-β審查"> Bypass Itunes Connect Testflight應用程序-β審查 </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-blslbebm-ou.html" target="_blank" title="Android Studio錯誤安裝Java"> Android Studio錯誤安裝Java </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-nvlblvfn-pd.html" target="_blank" title="根vs自舉組件"> 根vs自舉組件 </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-krlhbaih-nz.html" target="_blank" title="滾動到div的ID,堆疊後「停止」 DIV ID隱藏(不smoth滾動)"> 滾動到div的ID,堆疊後「停止」 DIV ID隱藏(不smoth滾動) </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-xhraizgw-ok.html" target="_blank" title="如何模擬來電?"> 如何模擬來電? </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-yngkhxee-ne.html" target="_blank" title="預期一個字符串,但是BEGIN_ARRAY- Gson"> 預期一個字符串,但是BEGIN_ARRAY- Gson </a> </li> </ul> </div> </div> </div> <p class="article-nav-bar"></p> <div class="row sidebar article-nav"> <div class="row box_white visible-sm visible-md visible-lg margin-zero"> <div class="top"> <h3 class="title"><i class="glyphicon glyphicon-th-list"></i> 相關問題</h3> </div> <div class="article-relative-content"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-mqammlks-hr.html" target="_blank" title="模擬在IE11"> 模擬在IE11 </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-zzheyjex-bcx.html" target="_blank" title="如何強制IE9在IE9文檔模式下渲染?"> 如何強制IE9在IE9文檔模式下渲染? </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-ujbgoeiv-bca.html" target="_blank" title="如何在HTML中模擬列表?"> 如何在HTML中模擬列表? </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-mbtjujfu-ue.html" target="_blank" title="在IE9中強制兼容模式"> 在IE9中強制兼容模式 </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-xgdrnqkk-vk.html" target="_blank" title="如何讓IE9模擬IE7?"> 如何讓IE9模擬IE7? </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-mbqfrtoa-va.html" target="_blank" title="如何在Ie9中禁用HTML Html按鈕的藍色發光"> 如何在Ie9中禁用HTML Html按鈕的藍色發光 </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-kxkhyhce-nr.html" target="_blank" title="如何在HTML中爲IE9製作四捨五入的邊框"> 如何在HTML中爲IE9製作四捨五入的邊框 </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-xidbhnyg-bob.html" target="_blank" title="如何強制ie11請求新的favicon?"> 如何強制ie11請求新的favicon? </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-sglhhzsz-ns.html" target="_blank" title="HTML模擬在文本框"> HTML模擬在文本框 </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-vxmjehbw-gq.html" target="_blank" title="如何強制樣式HTML元素?"> 如何強制樣式HTML元素? </a> </li> </ul> </div> </div> </div> </div> </div> </div> </div><!-- wrap end--> <!-- footer --> <footer id="footer"> <div class="bg-simple lt"> <div class="container"> <div class="row padder-v m-t"> <div class="col-xs-8"> <ul class="list-inline"> <li><a href="http://hk.uwenku.com/contact">聯系我們</a></li> <li>© 2020 HK.UWENKU.COM</li> <li><a target="_blank" href="https://beian.miit.gov.cn/">沪ICP备13005482号-4</a></li> <li><script type="text/javascript" src="https://v1.cnzz.com/z_stat.php?id=1280101193&web_id=1280101193"></script></li> <li><a href="http://www.uwenku.com/" target="_blank" title="优文库">简体中文</a></li> <li><a href="http://hk.uwenku.com/" target="_blank" title="優文庫">繁體中文</a></li> <li><a href="http://ru.uwenku.com/" target="_blank" title="поле вопросов и ответов">Русский</a></li> <li><a href="http://de.uwenku.com/" target="_blank" title="Frage - und - antwort - Park">Deutsch</a></li> <li><a href="http://es.uwenku.com/" target="_blank" title="Preguntas y respuestas">Español</a></li> <li><a href="http://hi.uwenku.com/" target="_blank" title="कार्यक्रम प्रश्न और उत्तर पार्क">हिन्दी</a></li> <li><a href="http://it.uwenku.com/" target="_blank" title="IL Programma di chiedere Park">Italiano</a></li> <li><a href="http://ja.uwenku.com/" target="_blank" title="プログラム問答園区">日本語</a></li> <li><a href="http://ko.uwenku.com/" target="_blank" title="프로그램 문답 단지">한국어</a></li> <li><a href="http://pl.uwenku.com/" target="_blank" title="program o park">Polski</a></li> <li><a href="http://tr.uwenku.com/" target="_blank" title="Program soru ve cevap parkı">Türkçe</a></li> <li><a href="http://vi.uwenku.com/" target="_blank" title="Đáp ứng viên">Tiếng Việt</a></li> <li><a href="http://fr.uwenku.com/" target="_blank" title="Programme interrogation Park">Française</a></li> </ul> </div> </div> </div> </div> </div> </footer> <!-- / footer --> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?f78a970f17b19a79fc477a3378096f29"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </body> </html>