2014-09-12 77 views
1

我有兩個樣式表,一個用於移動,一個用於計算機。 默認情況下,我想使用我的移動工作表。css3媒體查詢頭不工作

我的頭檢查:

<link rel='stylesheet' media='all' href='css/mobile.css' /> 
<link rel='stylesheet' media='screen and (min-width: 580px)' href='css/large.css' /> 

,但我仍然似乎可以用我的大樣式表時,是否在移動瀏覽器! (iphone 4)

+0

你爲什麼這麼說?什麼是行爲?請詳細說明... – LcSalazar 2014-09-12 15:23:45

回答

0

嘗試做這樣的事情: (我的代碼)

<link href="css/mobile_portrait.css" rel="stylesheet" type="text/css" media="only screen and (min-width: 320px) and (orientation: portrait)"> 
<link href="css/mobile_landscape.css" rel="stylesheet" type="text/css" media="only screen and (min-width: 480px) and (orientation: landscape)"> 
<link href="css/tablet.css" rel="stylesheet" type="text/css" media="only screen and (min-width: 769px)"> 
<link href="css/netbook.css" rel="stylesheet" type="text/css" media="only screen and (min-width: 1024px)"> 
<link href="css/desktop.css" rel="stylesheet" type="text/css" media="only screen and (min-width: 1224px)"> 

(這只是和示例)

0

我的問題是,iPhone手機似乎調整的內容。

我用:

<meta name="viewport" content="width=device-width, initial-scale=1"> 

...,以防止在手機瀏覽器大小調整。

把這個標籤放在頭上,就在我的媒體查詢之前。 現在媒體查詢功能正常。