Disable landscape-mode for mobile devices

こ雲淡風輕ζ 提交于 2019-12-01 13:32:28

问题


Hi there i created a responsive mobile website using this:

max-width(480px) {etc..} 

+

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">  

For every mobile device the website looks the same => great.

But when i change to landscape there is more than 480px and the website-variation of the desktop displays.

Is there any possibility to disable the auto-rotate or to show the portrait-mode on mobile-device even if there is more than 480px?

Greetings


回答1:


You can try and target specific orientation with your media query:

@media max-width(600px) and (orientation: landscape) {
    rules for landscaped devices...
}

More on media queries:

https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries




回答2:


Change your media query to a higher value?

max-width(600px) {etc..}


来源:https://stackoverflow.com/questions/24535361/disable-landscape-mode-for-mobile-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!