@media查询不起作用的情况下iPhone 5和iPad 4操作系统。我已使用以下CSS为每个操作系统和设备设置不同的屏幕样式。媒体查询不适用于iPhone和iPad
我明确地检查了我的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 media query issues)。任何人都可以解释背后的原因,在这种情况下,像素比是否重要?
这是否意味着我的CSS应该可以在iPad上使用?但是,它不工作... – DShah 2013-02-12 10:23:55
我在你的链接,在上一次更新部分中得到了好点...我会尝试... – DShah 2013-02-12 10:28:20