forked from anoved/Columnate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug.html
74 lines (66 loc) · 2.8 KB
/
debug.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Device Debug</title>
<style>
*, *::before, *::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 10px;
background: #f8f8f8;
}
.info {
font-size: 1.2em;
margin: 5px 0;
}
.box {
border: 4px solid black; /* Thicker to test space usage */
display: flex;
align-items: center;
justify-content: center;
font-size: 1.2em;
background: rgba(0, 0, 0, 0.05);
}
.full-width { width: 100%; }
.vw { width: 100vw; }
.vh { height: 100vh; }
.dvw { width: 100dvw; }
.dvh { height: 100dvh; }
</style>
</head>
<body>
<h1>Device Debug Info</h1>
<div class="info">Screen Size: <span id="screenSize"></span></div>
<div class="info">Available Size: <span id="availableSize"></span></div>
<div class="info">Viewport Size: <span id="viewportSize"></span></div>
<div class="info">Device Pixel Ratio: <span id="dpr"></span></div>
<h2>Measured Elements</h2>
<div class="box full-width">100% width (<span id="fullWidth"></span>)</div>
<div class="box vw">100vw width (<span id="vwWidth"></span>)</div>
<div class="box vh">100vh height (<span id="vhHeight"></span>)</div>
<div class="box dvw">100dvw width (<span id="dvwWidth"></span>)</div>
<div class="box dvh">100dvh height (<span id="dvhHeight"></span>)</div>
<script>
function updateInfo() {
document.getElementById("screenSize").textContent = `${screen.width} x ${screen.height}`;
document.getElementById("availableSize").textContent = `${screen.availWidth} x ${screen.availHeight}`;
document.getElementById("viewportSize").textContent = `${window.innerWidth} x ${window.innerHeight}`;
document.getElementById("dpr").textContent = window.devicePixelRatio;
document.getElementById("fullWidth").textContent = document.querySelector(".full-width").offsetWidth;
document.getElementById("vwWidth").textContent = document.querySelector(".vw").offsetWidth;
document.getElementById("vhHeight").textContent = document.querySelector(".vh").offsetHeight;
document.getElementById("dvwWidth").textContent = document.querySelector(".dvw").offsetWidth;
document.getElementById("dvhHeight").textContent = document.querySelector(".dvh").offsetHeight;
}
window.addEventListener("resize", updateInfo);
updateInfo();
</script>
</body>
</html>