-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrem.html
More file actions
51 lines (51 loc) · 1.21 KB
/
rem.html
File metadata and controls
51 lines (51 loc) · 1.21 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
42
43
44
45
46
47
48
49
50
51
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>REM Unit</title>
<style>
html {
font-size: 16px;
}
body {
font-family: sans-serif;
padding: 20px;
background: #f5f5f5;
}
h2 {
font-size: 18px;
margin-bottom: 12px;
color: #333;
}
.box {
font-size: 20px;
background: #e0eaff;
padding: 2rem;
border-radius: 6px;
margin-bottom: 12px;
}
.inner {
font-size: 1.5rem;
background: #4f8ef7;
color: white;
padding: 1rem;
border-radius: 4px;
}
p {
font-size: 13px;
color: #666;
margin-top: 8px;
}
</style>
</head>
<body>
<h2>rem — Always relative to root (html)</h2>
<div class="box">
Parent has font-size: 20px — but padding uses rem
<div class="inner">1.5rem = 24px no matter what the parent says</div>
</div>
<p>rem always refers to the root html font-size (16px by default).</p>
<p>No compounding — predictable everywhere in your project.</p>
</body>
</html>