2011-11-27 73 views
1

我一直在第一次使用媒體查詢,事情進展順利,但似乎遇到了一個奇怪的問題。@media min-width不被firefox識別8

這裏是我的CSS:

@media only screen and (min-width:481px) and (max-width:768px) { /* tablet portrait */ 
    css here 
} 

@media only screen and (min-width:321px) and (max-width:480px) { /* mobile landscape */ 
    css here 
} 

@media only screen and (max-width:320px){ /* mobile portrait */ 
    css here 
} 

一切正常在Chrome和樣式表按預期實施。在Firefox中,最後的樣式表(最大寬度:320px)沒有被拾取。

我做了很多搜索,找不到任何類似的東西。

非常感激,如果任何人有任何意見...

+0

不應該是320px? –

+0

是的,它應該。我已經改變了我的代碼,這沒有什麼區別。在上面會改變。 – Ste77

+1

最接近的答案我能找到:http://stackoverflow.com/questions/7663005/is-firefox-6-7-handling-max-width320px-media-query-wrong –

回答

2

超級晚在這裏,但只是改變了

@media only screen and (max-width:320px){ /* mobile portrait */ 
    css here 
} 

@media only screen and (max-width:768px){ /* mobile portrait */ 
    css here 
} 

出於某種原因,Firefox將不承認低於480px的任何東西,所以如果我們將320px更改爲768px,它將作爲默認值,而更精確的查詢將覆蓋它。

編輯:確保覆蓋元素低於CSS中的iphone。

+0

我剛剛浪費了太久,想知道我的max-width:320px媒體查詢不會在Firefox中觸發。我讀過這個,試過Chrome並且它可以工作。哎呀。 -1 Firefox。 – PaulBM

1

只是爲了增加我的經驗;我遇到了同樣的問題,但事實證明禁用Firebug插件使其表現得應該如此。我正在使用FF 15(mac)。 Firebug 1.10.03

我建議先禁用所有的插件,看看它是否有效,然後再逐一打開它們。