2017-05-31 124 views
0

我建立了一個響應式設計的網站。在Chrome,Mozilla Firefox,Opera中一切正常,但Internet Explorer(版本10,11也)在桌面PC上顯示平板電腦版本。我如何強制IE使用桌面版?先謝謝你。媒體查詢如下:在Internet Explorer中的響應式設計

@media only screen and (min-width: 481px) {}\\ for Tablet 
@media only screen and (min-width: 769px) {} \\for Desktop PC 
+0

您需要IE附加代碼:HTTPS:/ /msdn.microsoft.com/en-us/library/hh869615(v=vs.85).aspx – Gerard

+0

IE 10和11支持媒體查詢。你能分享你的CSS包括那些媒體查詢嗎? –

+0

@Gerard,謝謝你的努力。我在鏈接中嘗試瞭解決方案,但無法使其工作。對於屏幕最小寬度:481px我應該添加@ -ms-viewport {width:481px; }。正確? –

回答

0

下面的代碼加載mystyles.css在所有瀏覽器和負載僅在Internet Explorer 8 complex.css:

<link rel="stylesheet" media="screen and (min-width:600px)" href="mystyles.css" /> 

<!--[if (IE 8)]> 
<link rel="stylesheet" media="screen" href="complex.css" title="complex layout" /> 
<![endif]--> 
+0

我應該爲Internet Explorer使用單獨的css文件嗎?這個代碼必須在每個頁面中? –

+0

IT添加在頭文件 –

+1

當我將此字符串添加到標題時,它在移動設備上無法正確顯示 –