1

I have build a web site. If a device (smartphone or tablet) visit it, the system redirect the device in another page (version for mobile) m_index.aspx.

Now I want to force all device (smartphone or tablet) to sho my web site in landscape mode. It is possibile to rotate the screen automatically before it open some page?

regards

bircastri
  • 2,169
  • 13
  • 50
  • 119

1 Answers1

1
body { display:block; }
@media only screen and (orientation:portrait){
  body {  
    height: 100vw;
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
    transform: rotate(90deg);
  }
}
@media only screen and (body {  
     -webkit-transform: rotate(0deg);
     -moz-transform: rotate(0deg);
     -o-transform: rotate(0deg);
     -ms-transform: rotate(0deg);
     transform: rotate(0deg);
  }
}

I used this time ago, if you don't like my method google searching return lots of answers

LellisMoon
  • 4,810
  • 2
  • 12
  • 24
  • If I try to use your code into my css file, I have an error in the second point #only screen and (body.... – bircastri Oct 21 '16 at 09:51
  • post your html with some css and then we can see whats going wrong – LellisMoon Oct 21 '16 at 09:53
  • Because there is a syntax error: `@media only screen and (orientation: landscape) {`, body on the next line. I'm not sure if targeting the landscape is even needed. – veksen Oct 21 '16 at 10:05