screen对象及属性(availWidth、availHeight)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>screen对象及属性(availWidth、availHeight)</title>
    <!-- 
        屏幕可用
        screen.availWidth;获取屏幕宽度
        screen.availHeight;获取屏幕高度
        浏览器窗口
        window.innerWidth;获取浏览器窗口宽度
        window.innerHeight;获取浏览器窗口高度
     -->
</head>
<body>
    <script>
        console.log(screen.availWidth);//电脑屏幕宽
        console.log(screen.availHeight);//电脑屏幕高
        console.log(innerWidth);//浏览器窗口宽
        console.log(innerHeight);//浏览器窗口高
    </script>
</body>
</html>

posted on 2019-12-21 17:05  loongw  阅读(423)  评论(0编辑  收藏  举报

导航