2014-02-27 54 views
1

我正在處理響應式設計,但沒有正確地得到它。我需要爲這些設備編寫媒體查詢分辨率如下。什麼是特定設備的媒體查詢?

240 * 320,

240 * 480,

320 * 480,

480×800,

480 * 856

到目前爲止我已經嘗試這些媒體查詢但其衝突

@media only screen and (max-width:240px) { /* cover 240px portrait */} 

@media only screen and (min-width:320px) and (orientation : landscape) {/* cover 320px landscape for 240*320 */} 

@media only screen and (min-width : 479px) and (orientation : landscape) {/* cover 480px landscape */} 

@media only screen and (min-width : 480px) and (orientation:portrait) {/* cover 480px portrait */} 

回答

0

以下是標準設備的媒體查詢。您可以在定義的媒體中分別編寫全局樣式和設備特定的樣式。

/* Smartphones (portrait and landscape) ----------- */ 
@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) { 
/* Styles */ 
} 

/* Smartphones (landscape) ----------- */ 
@media only screen 
and (min-width : 321px) { 
/* Styles */ 
} 

/* Smartphones (portrait) ----------- */ 
@media only screen 
and (max-width : 320px) { 
/* Styles */ 
} 

/* iPads (portrait and landscape) ----------- */ 
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) { 
/* Styles */ 
} 

/* iPads (landscape) ----------- */ 
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) { 
/* Styles */ 
} 

/* iPads (portrait) ----------- */ 
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) { 
/* Styles */ 
} 

/* Desktops and laptops ----------- */ 
@media only screen 
and (min-width : 1224px) { 
/* Styles */ 
} 

/* Large screens ----------- */ 
@media only screen 
and (min-width : 1824px) { 
/* Styles */ 
} 

/* iPhone 4 ----------- */ 
@media 
only screen and (-webkit-min-device-pixel-ratio : 1.5), 
only screen and (min-device-pixel-ratio : 1.5) { 
/* Styles */ 
} 

更多信息here。希望能幫助到你。

+0

需要一些關於如何寫這些的更多細節? – user2787474