2014-02-27 40 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