<html>
<body>
<h1>Window 对象</h1>
<h2>matchMedia() 方法</h2>
<p id="demo"></p>
<script>
let text;
if (matchMedia("(max-width: 700px)").matches) {
text = "屏幕宽度小于或等于 700 像素。";
} else {
text = "屏幕至少有 700 像素宽。";
}
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>