-
Notifications
You must be signed in to change notification settings - Fork 0
/
rem原理.html
37 lines (36 loc) · 988 Bytes
/
rem原理.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
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" >
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalabe=0">
</head>
<style type="text/css">
html {
font-size: 16px;
}
@media screen and (min-width: 320px) {
body {font-size: 16px}
}
@media screen and (min-width: 481px) and (max-width:640px) {
body {font-size: 18px}
}
@media screen and (min-width: 641px) {
body {font-size: 20px}
}
img {
width: 100%;
}
</style>
<body>
<div>Rem原理</div>
<div>
<p style="font-size: 2em">字体大小</p>
<p>rem布局的本质是等比缩放,一般是基于宽度。</p>
<p>假设我们将屏幕宽度平均分成100份,每一份的宽度用x表示,x = 屏幕宽度 / 100,如果将x作为单位,x前面的数值就代表屏幕宽度的百分比</p>
</div>
<div>
<img src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1478889692,1943958954&fm=26&gp=0.jpg">
</div>
</body>
</html>