-
Notifications
You must be signed in to change notification settings - Fork 0
/
units.html
66 lines (57 loc) · 1.47 KB
/
units.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
64
65
66
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>CSS Units</title>
<style>
div {
margin-bottom: 10px;
background-color: blue;
height: 20px;
}
#cm {
width: 10cm;
}
#mm {
width: 100mm;
}
#in {
width: 2in;
}
#pt {
width: 144pt;
/* 1 pt = 1/72 of inch so should be the same as 1in */
}
#pc {
width: 12pc;
/* 1 pc = 12pt so 12pc = 144pt then since 1pt = 1/72 inch = 2inches */
}
</style>
</head>
<body>
<h1>CSS Absolute Units</h1>
<div id="cm">cm</div>
<div id="mm">mm</div>
<div id="in">in</div>
<div id="pt">pt</div>
<div id="pc">pc</div>
<div id="px">px</div>
<h2>CSS Relative Units</h2>
<div>em relative to the font-size of the element 2em = 2 times current font?</div>
<div>ex relative to the x-height of the current font</div>
<div>ch (relative to the width of the 0 in the current font)</div>
<div>rem relative to the font-size of the document root</div>
<div>1% = 1vw unit (viewport width)</div>
<div>1% = 1vh unit (viewport height)</div>
<div>vmin</div>
<div>vmax</div>
Q unit = 0.25mm a quarter of a millimeter px to em conversion? Aspect ratios is supported?
<pre>
@media screen and (min-aspect-ratio: 16/10) {
/* something for wide screens */
}
</pre>
</body>
</html>