-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexample.html
77 lines (69 loc) · 2.11 KB
/
example.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
67
68
69
70
71
72
73
74
75
76
77
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1.0">
<title>v-unit demo</title>
<script type="text/javascript" src="v-unit.js"></script>
<style type="text/css">
html, body {
margin:0;
padding:0;
font-family: verdana, arial, sans-serif;
}
a {
display: block;
margin: 0 auto;
background: #ff8c00;
font-size: 36px;
text-align: center;
}
div {
overflow: hidden;
color: white;
margin: 0 auto;
font-size: 10px;
}
pre {
color: white;
font-weight: bold;
display: inline;
white-space: normal;
background: black;
}
.first { background: gray; }
.second { background: green; }
.third { background: red; }
.fourth { background: orange; }
</style>
</head>
<body>
<a href="https://github.com/joaocunha/v-unit">Check on GitHub</a>
<h1>How to use v-unit.js to set viewport relative heights and widths:</h1>
<ol>
<li>Add the v-unit.js plugin on the head, before your CSS files (helps preventing FOUC);</li>
<li>Set classes like vh10 for 10% viewport height and vw35 for 35% of viewport width;</li>
<li>There's no 3.</li>
</ol>
<div class="vh10 vw50 first">
<pre>class="vh10 vw50"</pre>
<p>height: 10% of the viewport</p>
<p>width: 50% of the viewport</p>
</div>
<div class="vh25 vw35 second">
<pre>class="vh25 vw35"</pre>
<p>height: 25% of the viewport</p>
<p>width: 35% of the viewport</p>
</div>
<div class="vh100 vw100 third">
<pre>class="vh100 vw100"</pre>
<p>height: 100% of the viewport</p>
<p>width: 100% of the viewport</p>
</div>
<div class="vh31 vw63 fourth">
<pre>class="vh31 vw63"</pre>
<p>height: 31% of the viewport</p>
<p>width: 63% of the viewport</p>
</div>
</body>
</html>