-
Notifications
You must be signed in to change notification settings - Fork 831
Expand file tree
/
Copy pathsample-page-static-CSS.html
More file actions
335 lines (316 loc) · 11.6 KB
/
sample-page-static-CSS.html
File metadata and controls
335 lines (316 loc) · 11.6 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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Variable Font example page (static CSS)</title>
<style>
@font-face {
font-family: 'Amstelvar VF';
src: url('fonts/Amstelvar-Roman-VF.woff2') format('woff2-variations');
font-weight: 300 900;
font-stretch: 75 150;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Amstelvar VF';
src: url('fonts/Amstelvar-Italic-VF.woff2') format('woff2-variations');
font-weight: normal;
font-stretch: normal;
font-style: italic;
font-display: swap;
}
html {
box-sizing: border-box;
font-size: 100%;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
body {
font: 1.2em "Amstelvar VF", Georgia, serif;
margin: 20px;
padding: 0;
}
.wrapper {
width: 100%;
display: grid;
grid-template-columns: repeat(auto-fill,minmax(29rem,1fr));
grid-gap: 1.5rem;
}
textarea {
font-family: monospace;
display: block;
margin-bottom: 10px;
height: 160px;
background-color: #F4F7F8;
border: none;
border-left: 6px solid #558ABB;
color: #4D4E53;
padding: 1rem 0;
width: 100%;
}
textarea:nth-of-type(1) {
height: 300px;
}
textarea:nth-of-type(2) {
height: 200px;
}
.playable-buttons {
text-align: right;
width: 100%;
padding: 0.5rem 0;
font-size: 100%;
}
.section {
width: 100%;
border: 1px solid #4D4E53;
border-radius: 2px;
padding: 10px 14px 10px 10px;
margin-bottom: 10px;
}
.section input {
display: block;
margin: 5px;
}
.container * {
margin: 0.5rem auto 1rem;
max-width: 42rem;
}
</style>
<style class="editable1">
.container1 h1 {
font-optical-sizing: auto;
font-size: 5rem;
font-stretch: 85%;
font-weight: 450;
}
.container1 h2 {
font-optical-sizing: auto;
font-size: 2.25rem;
font-stretch: 95%;
font-weight: 575;
}
.container1 p {
font-optical-sizing: auto;
font-size: 1rem;
font-stretch: 100%;
font-weight: 375;
}
</style>
<style class="editable2">
.demo2 {
--text-wght: 375;
--text-wdth: 100;
--text-opsz: 16;
}
.container2 h1, .container2 h2, .container2 p {
font-size: 5rem;
font-variation-settings: 'wght' var(--text-wght), 'wdth' var(--text-wdth), 'opsz' var(--text-opsz);
}
.container2 h1 {
--text-wght: 450;
--text-wdth: 85;
--text-opsz: 80;
font-size: 5rem;
}
.container2 h2 {
--text-wght: 575;
--text-wdth: 95;
--text-opsz: 36;
font-size: 2.25rem;
}
.container2 p {
font-size: 1rem;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="demo1">
<section class="section section1">
<div class="container container1">
<h1>Moby Dick</h1>
<h2>CHAPTER 1. Loomings.</h2>
<p>
Call me Ishmael. Some years ago—never mind how long precisely–having
little or no money in my purse, and nothing particular to interest me on
shore, I thought I would sail about a little and see the watery part of
the world. It is a way I have of driving off the spleen and regulating the
circulation. Whenever I find myself growing grim about the mouth; whenever
it is a damp, drizzly November in my soul; whenever I find myself
involuntarily pausing before coffin warehouses, and bringing up the rear
of every funeral I meet; and especially whenever my hypos get such an
upper hand of me, that it requires a strong moral principle to prevent me
from deliberately stepping into the street, and methodically knocking
people’s hats off then, I account it high time to get to sea as soon
as I can. This is my substitute for pistol and ball. With a philosophical
flourish Cato throws himself upon his sword; I quietly take to the ship.
There is nothing surprising in this. If they but knew it, almost all men
in their degree, some time or other, cherish very nearly the same feelings
towards the ocean with me.
</p>
</div>
</section>
<textarea class="playable-css1">
.container1 h1 {
font-optical-sizing: auto;
font-size: 5rem;
font-stretch: 85%;
font-weight: 450;
}
.container1 h2 {
font-optical-sizing: auto;
font-size: 2.25rem;
font-stretch: 90%;
font-weight: 575;
}
.container1 p {
font-optical-sizing: auto;
font-size: 1rem;
font-stretch: 100%;
font-weight: 375;
}
</textarea>
<textarea id="code1" class="playable-html1">
<div class="container container1">
<h1>Moby Dick</h1>
<h2>CHAPTER 1. Loomings.</h2>
<p>
Call me Ishmael. Some years ago—never mind how long precisely–having
little or no money in my purse, and nothing particular to interest me on
shore, I thought I would sail about a little and see the watery part of
the world. It is a way I have of driving off the spleen and regulating the
circulation. Whenever I find myself growing grim about the mouth; whenever
it is a damp, drizzly November in my soul; whenever I find myself
involuntarily pausing before coffin warehouses, and bringing up the rear
of every funeral I meet; and especially whenever my hypos get such an
upper hand of me, that it requires a strong moral principle to prevent me
from deliberately stepping into the street, and methodically knocking
people’s hats off then, I account it high time to get to sea as soon
as I can. This is my substitute for pistol and ball. With a philosophical
flourish Cato throws himself upon his sword; I quietly take to the ship.
There is nothing surprising in this. If they but knew it, almost all men
in their degree, some time or other, cherish very nearly the same feelings
towards the ocean with me.
</p>
</div>
</textarea>
</div>
<div class="demo2">
<section class="section section2">
<div class="container container2">
<h1>Moby Dick</h1>
<h2>CHAPTER 1. Loomings.</h2>
<p>
Call me Ishmael. Some years ago—never mind how long precisely–having
little or no money in my purse, and nothing particular to interest me on
shore, I thought I would sail about a little and see the watery part of
the world. It is a way I have of driving off the spleen and regulating the
circulation. Whenever I find myself growing grim about the mouth; whenever
it is a damp, drizzly November in my soul; whenever I find myself
involuntarily pausing before coffin warehouses, and bringing up the rear
of every funeral I meet; and especially whenever my hypos get such an
upper hand of me, that it requires a strong moral principle to prevent me
from deliberately stepping into the street, and methodically knocking
people’s hats off then, I account it high time to get to sea as soon
as I can. This is my substitute for pistol and ball. With a philosophical
flourish Cato throws himself upon his sword; I quietly take to the ship.
There is nothing surprising in this. If they but knew it, almost all men
in their degree, some time or other, cherish very nearly the same feelings
towards the ocean with me.
</p>
</div>
</section>
<textarea class="playable-css2">
.demo2 {
--text-wght: 375;
--text-wdth: 100;
--text-opsz: 16;
}
.container2 h1, .container2 h2, .container2 p {
font-size: 5rem;
font-variation-settings: 'wght' var(--text-wght), 'wdth' var(--text-wdth), 'opsz' var(--text-opsz);
}
.container2 h1 {
--text-wght: 450;
--text-wdth: 85;
--text-opsz: 80;
font-size: 5rem;
}
.container2 h2 {
--text-wght: 575;
--text-wdth: 95;
--text-opsz: 36;
font-size: 2.25rem;
}
.container2 p {
font-size: 1rem;
}
</textarea>
<textarea id="code2" class="playable-html2">
<div class="container container2">
<h1>Moby Dick</h1>
<h2>CHAPTER 1. Loomings.</h2>
<p>
Call me Ishmael. Some years ago—never mind how long precisely–having
little or no money in my purse, and nothing particular to interest me on
shore, I thought I would sail about a little and see the watery part of
the world. It is a way I have of driving off the spleen and regulating the
circulation. Whenever I find myself growing grim about the mouth; whenever
it is a damp, drizzly November in my soul; whenever I find myself
involuntarily pausing before coffin warehouses, and bringing up the rear
of every funeral I meet; and especially whenever my hypos get such an
upper hand of me, that it requires a strong moral principle to prevent me
from deliberately stepping into the street, and methodically knocking
people’s hats off then, I account it high time to get to sea as soon
as I can. This is my substitute for pistol and ball. With a philosophical
flourish Cato throws himself upon his sword; I quietly take to the ship.
There is nothing surprising in this. If they but knew it, almost all men
in their degree, some time or other, cherish very nearly the same feelings
towards the ocean with me.
</p>
</div>
</textarea>
</div>
</div>
<div class="playable-buttons">
<input id="reset" type="button" value="Reset">
</div>
</body>
<script>
var section1 = document.querySelector('.section1');
var editable1 = document.querySelector('.editable1');
var textareaHTML1 = document.querySelector('.playable-html1');
var textareaCSS1 = document.querySelector('.playable-css1');
var section2 = document.querySelector('.section2');
var editable2 = document.querySelector('.editable2');
var textareaHTML2 = document.querySelector('.playable-html2');
var textareaCSS2 = document.querySelector('.playable-css2');
var reset = document.getElementById('reset');
var htmlCode1 = textareaHTML1.value;
var cssCode1 = textareaCSS1.value;
var htmlCode2 = textareaHTML2.value;
var cssCode2 = textareaCSS2.value;
function fillCode() {
editable1.innerHTML = textareaCSS1.value;
section1.innerHTML = textareaHTML1.value;
editable2.innerHTML = textareaCSS2.value;
section2.innerHTML = textareaHTML2.value;
}
reset.addEventListener('click', function () {
textareaHTML1.value = htmlCode1;
textareaCSS1.value = cssCode1;
textareaHTML2.value = htmlCode2;
textareaCSS2.value = cssCode2;
fillCode();
});
textareaHTML1.addEventListener('input', fillCode);
textareaCSS1.addEventListener('input', fillCode);
textareaHTML2.addEventListener('input', fillCode);
textareaCSS2.addEventListener('input', fillCode);
window.addEventListener('load', fillCode);
</script>
</html>