[英]media query not working for iphone 5 landscape
I'm using media queries to do a simple background color change and it doesn't work on iphone 5. I'm not sure if my queries are wrong or not but here is my meta tag: 我正在使用媒体查询来进行简单的背景颜色更改,并且在iphone 5上不起作用。我不确定查询是否错误,但这是我的meta标签:
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
and here are my media queries: 这是我的媒体查询:
@media only screen and (min-device-width : 320px) and (max-device-width : 568px) {
.loginPage
{
background: red !important;
}
}
@media only screen and (min-device-width : 320px) and (max-device-width : 568px) and (orientation : landscape) {
.loginPage
{
background: green !important;
}
} }
the red background is working but when I rotate my device the background doesn't change to green. 红色背景正在工作,但是当我旋转设备时,背景不会变为绿色。 any help would be appreciated.
任何帮助,将不胜感激。
Try the following. 尝试以下方法。 Increase the size of the landscape orientation.
增大横向尺寸。 I believe that when you turn the iPhone into landscape mode you will now have a much higher device width.
我相信,当您将iPhone转换为横向模式时,您现在将拥有更大的设备宽度。
You can try increasing the landscape max-width to 1136px, which should be the iPhone 5's width in landscape mode. 您可以尝试将横向最大宽度增加到1136px,这应该是横向模式下iPhone 5的宽度。 If this does not work I would recommend increasing the size of the max width to a crazy large number and work your way down to eliminate the problem.
如果这样做不起作用,我建议将最大宽度的大小增加到一个疯狂的大数字,然后逐步解决该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.