@media screen and (min-width: 320px) and (max-width: 767px) and (orientation: landscape) {
html {
transform: rotate(-90deg);
transform-origin: left top;
width: 100vh;
overflow-x: hidden;
position: absolute;
top: 100%;
left: 0;
}
}
Sent in by Andreas Gotfredsen.
I was just playing around with this but haven’t had total success. The vw and vh units still seem to refer to the original portrait orientation, so any layout done with these units breaks. Ideally, we would be able swap vw and vh when the page is rotated, but I couldn’t find any way to do that. One workaround would be to define –vw and –vh variables and set them appropriately for each orientation, but then we are stuck with the clumsy calc()/var() syntax when using them.
Chris, we have for it now Screen Orientation API, see