简体   繁体   English

我的移动响应网站始终显示最小的CSS宽度视图-可能是什么原因造成的?

[英]My mobile responsive website always displays the smallest CSS width view - What might be causing this?

I am working on a mobile responsive website which is designed for iPhone 6 Plus and smaller. 我正在为iPhone 6 Plus和更小版本设计的移动响应网站。 (iPhone 6 & 5 for now). (目前仅适用于iPhone 6和5)。

When displaying in using "Inspect element" via Chrome browser and setting a device of ones I mentioned above - it works fine. 通过Chrome浏览器使用“检查元素”显示并设置我上面提到的设备时,它可以正常工作。

When displaying it on the real mobiles I only get the smallest width. 在实际手机上显示时,我只会得到最小的宽度。

@media (max-width: 415px) {
...
}

@media (min-width :  320px) and (max-width : 375px ) {
...
}

@media (min-width :  240px) and (max-width : 320px ) {
...
}

I used both of these in my HTML : 我在HTML中都使用了这两种方法:

<!--meta name="viewport" content="width=device-width, initial-scale=1.0"-->
<meta name="viewport" content="initial-scale=1.0,width=device-width,user-scalable=0" />

I cant paste all my code here, I have no permission. 我无法将所有代码粘贴到这里,没有我的许可。

What other problems might cause this? 还有哪些其他问题可能导致此问题? Are there better ways to test mobile responsive websites? 有更好的方法来测试移动响应网站吗? Because it seems like testing it on chrome or websites like 'screenfly' aren't that reliableץ 因为似乎在chrome或“ screenfly”之类的网站上进行测试并不可靠ץ

Your issue might be having same min-width and max-width at 320px 您的问题可能在320px处具有相同的min-widthmax-width

So, try this: 因此,请尝试以下操作:

@media (min-width :  321px) and (max-width : 375px ) {
...
}

@media (min-width :  240px) and (max-width : 320px ) {
...
}

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

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