-
Notifications
You must be signed in to change notification settings - Fork 2
/
vw.html
63 lines (55 loc) · 1.43 KB
/
vw.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>rem布局——vw</title>
<style>
/* 字体缩放方案 */
@media screen and (min-width: 320px) {
body {font-size: 1rem;}
}
@media screen and (min-width: 481px) and (max-width:640px) {
body {font-size: 1.1rem;}
}
@media screen and (min-width: 641px) {
body {font-size: 1.2rem;}
}
/* 字体缩放方案 */
.p1, .p2 {
border: 1px solid red;
margin: 10px 0;
}
.p1 {
width: 50vw;
height: 50vw;
font-size: 1.2em; /* 字体使用em */
}
.s1 {
font-size: 1.2em; /* 字体使用em */
}
.p2 {
width: 40vw;
height: 40vw;
}
.s2 {
font-size: 1.2em /* 字体使用em */
}
</style>
</head>
<body>
<div class="p1">
宽度为屏幕宽度的50%,字体大小1.2em
<div class="s1">
字体大小1.2.em
</div>
</div>
<div class="p2">
宽度为屏幕宽度的40%,字体大小默认
<div class="s2">
字体大小1.2em
</div>
</div>
<script src="//yanhaijing.com/assets/plugin/tongji/baidu.js"></script>
</body>
</html>