Skip to content

Instantly share code, notes, and snippets.

@felixprojekt
Created January 8, 2020 01:12
Show Gist options
  • Save felixprojekt/d9e554f52509fa99e4edc3b9f8af3969 to your computer and use it in GitHub Desktop.
Save felixprojekt/d9e554f52509fa99e4edc3b9f8af3969 to your computer and use it in GitHub Desktop.
hide-website-in-landscape
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.rotate-device {
display: none;
}
@media (orientation: landscape) and (max-height: 500px) {
html, body {
margin: 0;
height: 100%;
overflow: hidden;
}
.rotate-device {
display: block;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: white;
z-index: 99999;
overflow: hidden;
text-align: center;
padding: 50px;
font-size: 2rem;
}
.rotate-device img {
height: 120px;
margin: 40px auto;
display: block;
}
}
</style>
</head>
<body>
<div class="rotate-device">
<img src="img/turn_phone.png" alt="Rotate your device" />
<p>Please rotate your device</p>
</div>
<h1>Website content</h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment