html - 特定设备的媒体查询是什么?

标签 html css responsive-design media-queries

我正在研究响应式设计,但没有得到正确的解决方案。我需要为这些设备编写媒体查询,分辨率如下。

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 */}

最佳答案

以下是标准设备的媒体查询。您可以在定义的媒体中分别编写全局样式和设备特定样式。

/* 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 .希望对您有所帮助。

关于html - 特定设备的媒体查询是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22067549/

相关文章:

javascript - 在同一页面中为不同的字体使用不同的字体大小?

html - 带有图像的响应式 div

css - 无法对齐 css 元素

twitter-bootstrap - CSS 中的响应式 2 列正方形

html - 手机上的固定按钮闪烁

javascript - 是否可以使用 css/javascript 在主页上绘制?

javascript - 与 jquery 和 form 冲突

javascript - jQuery:附加列表不显示元素符号

html - 如何让div的高度尽量缩小?

css - 如何在 Syncfusion 响应式 MVC 网格中启用滚动