简体   繁体   English

@media查询不适用于iPad纵向(已搜索所有问题)

[英]@media query doesn't work on ipad portrait (already searched all questions)

Evening all, I am having a problem in media queries for ipad portrait here is my code. 晚上,我在ipad人像的媒体查询中遇到问题,这是我的代码。

@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait){//CSS HERE }

I tried using min-device-width and max-device-width , I also tried using only screen and all in my queries. 我尝试使用min-device-widthmax-device-width ,也尝试only screen使用only screenall查询。 I also added viewports 我还添加了视口

<meta content="True" name="HandheldFriendly">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta name="viewport" content="width=device-width">

However it's still not working on iPad portrait, keep in mind that all other media queries are working but this. 但是,它仍然不能在iPad portrait上运行,请记住,所有其他媒体查询都可以正常工作,但是可以。 Even when testing, using the inspect element it isn't taking the media queries into consideration. 即使在测试时,使用inspect元素也不会考虑媒体查询。

Any help? 有什么帮助吗?

Could it be that the other media queries on your page are overriding the styles from this one (if the breakpoints overlap)? 可能是您页面上的其他媒体查询覆盖了该样式中的样式(如果断点重叠)? Try commenting out your other queries and see if this one works? 尝试注释掉您的其他查询,看看是否可行?

ANSWER 回答

After some fiddling around I found out that it would be easier for me to use this 经过一番摆弄之后,我发现使用它会更容易

@media (min-width: 701px) and (max-width: 799px){//CSS HERE}

I read somewhere that it is better to do for resolutions rather than devices 我在某处读到,最好使用分辨率而不是设备

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM