-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_css.html
54 lines (47 loc) · 1.44 KB
/
check_css.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,viewport-fit=cover">
<style type="text/css">
html,body {height:100%;width:100%;margin:0;padding:0;background-color:red;}
body {
--safe-area-inset-top: env(safe-area-inset-top);
--safe-area-inset-bottom: env(safe-area-inset-bottom);
--safe-area-inset-left: env(safe-area-inset-left);
--safe-area-inset-right: env(safe-area-inset-right);
padding-top: env(safe-area-inset-top);
padding-right: env(safe-area-inset-right);
padding-bottom: env(safe-area-inset-bottom);
padding-left: env(safe-area-inset-left);
}
pre {
font-size: 2.0em;
}
</style>
</head>
<body>
<input type="button" value="check" onclick="onCheck()">
<br>
<pre id="preId"></pre>
<script>
function onCheck() {
let bodyEl = document.getElementsByTagName('body')[0];
var computed = window.getComputedStyle(bodyEl);
let str = "";
str += "width:" + computed.getPropertyValue('width');
str += ", ";
str += "height:" + computed.getPropertyValue('height');
str += "\n";
str += "top:" + computed.getPropertyValue('--safe-area-inset-top');
str += ", ";
str += "bottom:" + computed.getPropertyValue('--safe-area-inset-bottom');
str += "\n";
str += "left:" + computed.getPropertyValue('--safe-area-inset-left');
str += ", ";
str += "right:" + computed.getPropertyValue('--safe-area-inset-right');
let preEl = document.getElementById('preId');
preEl.innerHTML = str;
}
</script>
</body>
</html>