Skip to content

Instantly share code, notes, and snippets.

@yoavweiss
Forked from LeaVerou/dabblet.css
Last active August 29, 2015 14:20
Show Gist options
  • Save yoavweiss/dfaab93c705b2669277f to your computer and use it in GitHub Desktop.
Save yoavweiss/dfaab93c705b2669277f to your computer and use it in GitHub Desktop.
Media query to detect full screen mode!
/**
* Media query to detect full screen mode!
* Y U NO WORK Chrome??
* Firefox, you’re lovely.
*/
body {
background: red;
font: bold 400% Helvetica Neue, sans-serif;
color: white;
}
@media (device-width: 100vw) and (device-height: 100vh) {
body {
background: green;
}
body::before { content: "Full screen!!" }
}
<!-- content to be placed inside <body>…</body> -->
Is this thing on?
<div id=output></div>
// alert('Hello world!');
if (matchMedia("(max-width: 110vw)").matches)
document.getElementById("output").innerHTML = "MATCH";
else
document.getElementById("output").innerHTML = "no match :(";
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"","page":"javascript"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment