-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.html
More file actions
41 lines (38 loc) · 1.06 KB
/
index.html
File metadata and controls
41 lines (38 loc) · 1.06 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>网易云音乐</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//at.alicdn.com/t/font_386252_nz2ixfsdm0io1or.css">
<style>
*{
margin: 0;
padding: 0;
}
body, html {
height: 100%;
width: 100%;
background-color: #fff;
}
#app{
font-size: 0.14rem;
}
</style>
</head>
<body>
<div id="app"></div>
<script>
var desW=375//设计稿宽度375对应的根节点fontsize是100px即1rem=100px;
function refreshRem() {
var doc=document.documentElement;
var winW=doc.clientWidth;
var radio=winW/desW;//设计稿和窗口大小的比例
doc.style.fontSize=100*radio+'px';
}
refreshRem();
window.addEventListener('resize',refreshRem)//监听窗口大小的变化重新计算rem的大小
</script>
</body>
</html>