Created
August 16, 2012 11:33
-
-
Save markdurrant/3369502 to your computer and use it in GitHub Desktop.
Orientation media query example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Example html | |
<body> | |
<!-- change to landscape mode prompt --> | |
<div id="portrait"> | |
<h1>Please rotate your device. This game only works in landscape mode</h1> | |
</div> | |
<!-- game content start --> | |
<div> | |
<ul> | |
<li>One</li> | |
<li>Two</li> | |
<li>Three</li> | |
</ul> | |
</div> | |
<!-- game content end --> | |
</body> | |
*/ | |
/*hide landscape mode prompt as default*/ | |
#portrait{ | |
display: none; | |
} | |
/*fill screen with landscape mode prompt when in portrait mode*/ | |
@media screen and (orientation: portrait){ | |
#portrait{ | |
width: 100%; | |
height: 100%; | |
position: absolute; | |
z-index: 50; | |
background-color: white; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment