htmlcssmobileviewportportrait

How to lock viewport to Portrait Orientation in HTML5/CSS3


Is it possible to lock the view port's orientation to portrait on a mobile device?

I Googled it but could not find out exactly how to do it.


Solution

  • As my experience, it cannot be done as you are access the website from the browser. Which should have the lock orientation capability is the browser itself - e.g Safari, Chrome. Your HTML CSS code will not be feasible to control it.

    For example when you are building a hybrid mobile app - meaning an application with html css and js then convert it to mobile app with wrapper as a web view inside. Then you are capable to lock the screen orientation. There are some configuration need to be done and later on these will be converted to Objective C or Java.