1

I have a mobile version of a website in the vertical position. Is it possible to block the website? When you turn the phone horizontal, page still locked on vertical position.

If so, I ask for advice, because my attempts to do so using css were unsuccessful. Thank you.

kotos
  • 41
  • 2
  • 1
    And it's a bad idea.. Better use the `orientation` in `@media` queries and change your styles – AymDev Jan 31 '17 at 10:42

1 Answers1

0

try this media query it should work

@media (orientation: landscape) {
  body {
    -webkit-transform: rotate(-90deg);
    -moz-transform: rotate(-90deg);
    -o-transform: rotate(-90deg);
    -ms-transform: rotate(-90deg);
    transform: rotate(-90deg);
  }
}

original reference

Dev Man
  • 2,114
  • 3
  • 23
  • 38
  • Won't it turn completely upside down if you turn your device to the right ? And then if you turn your phone in portrait (but upside down), turn at 180deg ? – AymDev Jan 31 '17 at 10:47
  • Thank you Immortal Dude but it does not work properly :( – kotos Jan 31 '17 at 10:58