@media查询在iPhone 5 和 iPad 4 OS的情况下不起作用。我使用以下CSS为不同屏幕设置每个操作系统和设备的样式。
我明确检查了我的 iPad 和 iPhone 的宽度和高度,并基于此,我只保留了媒体查询。这在 ANDROID OS 上运行良好。
/*@media print {*/
/* iPhone 5 (Portrait) */
@media screen and (max-device-height: 568px) and (orientation: portrait) {
#map_canvas {
border: 1px dashed #C0C0C0;
width: 290px;
height: 473px;
}
}
/* iPad 4 (Portrait) */
@media screen and (max-device-height: 1024px) and (orientation: portrait) {
#map_canvas {
border: 1px dashed #C0C0C0;
width: 735px;
height: 929px;
}
}
/* iPad 4 (Landscape) */
@media screen and (max-device-width: 1024px) and (orientation: landscape) {
#map_canvas {
border: 1px dashed #C0C0C0;
width: 990px;
height: 673px;
}
}
/* Samsung 10.1 inch (Portrait) */
@media screen and (max-device-height: 1280px) and (orientation: portrait) {
#map_canvas {
border: 1px dashed #C0C0C0;
width: 790px;
height: 1140px;
}
}
/* Samsung 10.1 inch (Landscape) */
@media screen and (max-device-width: 1280px) and (orientation: landscape) {
#map_canvas {
border: 1px dashed #C0C0C0;
width: 1230px;
height: 680px;
}
}
/* Samsung 7.0 inch (Portrait) */
@media screen and (max-device-height: 1024px) and (orientation: portrait) {
#map_canvas {
border: 1px dashed #C0C0C0;
width: 570px;
height: 875px;
}
}
/* Samsung 7.0 inch (Landscape) */
@media screen and (max-device-width: 1024px) and (orientation: landscape) {
#map_canvas {
border: 1px dashed #C0C0C0;
width: 990px;
height: 455px;
}
}
@media all and (orientation: landscape) {
html, body {
height: auto;
}
}
每次我在上面的代码中进行各种更改测试时,我都会得到 LAST CSS 被引用以应用样式。
我找到了一个链接,(我还没有尝试过,但会在 mac 可用时立即尝试)但对此也有疑问(iphone/ipad 媒体查询问题)。谁能解释在这种情况下像素比很重要的原因?