-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
34 lines (34 loc) · 1.04 KB
/
index.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
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover"
/>
<title>可视化</title>
<script>
const clientWidth = document.documentElement.clientWidth;
const clientHeight = document.documentElement.clientHeight;
window.pageWidth =
clientWidth / clientHeight > 16 / 9
? clientHeight * (16 / 9)
: clientWidth;
const pageHeight = pageWidth / (16 / 9);
const string = `<style>html{
font-size: ${pageWidth / 100}px
}</style>`;
document.write(string);
</script>
</head>
<body>
<div id="root"></div>
<script>
const root = document.querySelector("#root");
root.style.width = `${pageWidth}px`;
root.style.height = `${pageHeight}px`;
root.style.marginTop = `${(clientHeight - pageHeight) / 2}px`;
</script>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>