|
|
@@ -0,0 +1,29 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="en">
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>Document</title>
|
|
|
+ <style>
|
|
|
+ #box {
|
|
|
+ width: 200px;
|
|
|
+ height: 300px;
|
|
|
+ margin-top: 150px;
|
|
|
+ margin-left: 400px;
|
|
|
+ background: aqua;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <div id="box"></div>
|
|
|
+ <script>
|
|
|
+ let box = document.getElementById("box");
|
|
|
+ // console.log(box.clientWidth);
|
|
|
+ // console.log(box.clientHeight);
|
|
|
+ console.log(box.offsetWidth)
|
|
|
+ console.log(box.offsetHeight)
|
|
|
+ console.log(box.offsetLeft)
|
|
|
+ console.log(box.offsetTop)
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|