2

I want to force an iPad to show a website only in landscape mode?

Is this possible?

laaposto
  • 11,835
  • 15
  • 54
  • 71

2 Answers2

4

You can set it with CSS:

 @media only screen and (orientation:portrait){
    html body * {
         display:none;
    }

 }
 @media only screen and (orientation:landscape){
   /* your CSS */
 }

In the portait mode all elemnts will be hidden. You can set a <div>Switch to landscape</div> to be only displayed in portait mode

laaposto
  • 11,835
  • 15
  • 54
  • 71
2

Safari's interface will still be in portrait mode and it's having issues with setting the height to 100% but you could rotate the entire html element when in portrait mode like this

html, body {
  height: 100%;
}

@media screen and (orientation: portrait){
    html {
        -webkit-transform: translateY(-100%) rotate(90deg);    
        transform: translateY(-100%) rotate(90deg);
        -webkit-transform-origin: left bottom;    
        transform-origin: left bottom;    
    }
}

Or see http://codepen.io/ckuijjer/full/Frosl

ckuijjer
  • 13,293
  • 3
  • 40
  • 45