Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
191
rated 0 times [  198] [ 7]  / answers: 1 / hits: 65887  / 7 Years ago, wed, april 26, 2017, 12:00:00

At the moment, i'm working on my site. The mobile version is almost done. But if I rotate my screen (smartphone for example) in landscape, it looks horrific. I tried to change it with queries but the result isn't quite nice. Is there a way to lock orientation so that it always stays in portrait-mode?



Edit:



I thought maybe I could do something with the height and the width. So that if the width of the screen is larger then the height, the body should rotate 90 degrees.


More From » css

 Answers
78

You need to add the following meta tag to your page header like so:



<meta http-equiv=ScreenOrientation content=autoRotate:disabled>


Or you can have separate CSS files for landscape and portrait mode like so:



<link rel=stylesheet type=text/css href=css/landscape.css media=screen and (orientation: landscape)>
<link rel=stylesheet type=text/css href=css/portrait.css media=screen and (orientation: portrait)>

[#57997] Tuesday, April 25, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dominiquezachariahh

Total Points: 343
Total Questions: 81
Total Answers: 106

Location: Monaco
Member since Fri, Sep 24, 2021
3 Years ago
;