1

I would like that when an iPad or other tablet views my website it is only in landscape mode and can't rotate when iPad is in portrait mode.

Is it possible with CSS or JavaScript? I've got my css called main.css and i would add a tablet.css only for tablets with horizontal orientation.

Prisoner
  • 27,391
  • 11
  • 73
  • 102
  • possible duplicate of [How do I lock the orientation to portrait mode in a iPhone Web Application?](http://stackoverflow.com/questions/1207008/how-do-i-lock-the-orientation-to-portrait-mode-in-a-iphone-web-application) – Prisoner Dec 07 '11 at 14:24
  • possible duplicate of [Prevent orientation change in iOS Safari](http://stackoverflow.com/questions/5298467/prevent-orientation-change-in-ios-safari) – user123444555621 Dec 07 '11 at 16:19

1 Answers1

0

Hmm. I don't think there's a simple answer for this. But a workaround could be to detect the size of the viewport: if the width is greater than the height, display normally. Otherwise, use CSS to rotate the main container 90 degrees. Good luck!

eddz
  • 583
  • 1
  • 6
  • 22
  • i can detect the orientaion but i dont know how dont rotate on portrait view –  Dec 07 '11 at 14:32
  • Unless there's a more elegant solution available, simply use CSS to rotate the main container if you detect the device is in portrait view. – eddz Dec 07 '11 at 14:35