Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>The Window Object</h1> <h2>The matchMedia() Method</h2> <p id="demo"></p> <script> let text; if (matchMedia("(max-width: 700px)").matches) { text = "The screen is less or equal to, 700 pixels wide."; } else { text = "The screen is at least 700 pixels wide."; } document.getElementById("demo").innerHTML = text; </script> </body> </html>