-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
820 lines (799 loc) · 30.6 KB
/
index.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
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
<!DOCTYPE html>
<html>
<head>
<title>MaterialZ</title>
<meta name="description" content="MaterialZ is a CSS library created by Zachary Yaro that offers a lightweight implementation of the Material Design spec." />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="theme-color" content="#263238" />
<link rel="shortcut icon" type="image/x-icon" href="logo/favicon.ico" />
<link rel="icon" sizes="192x192" href="logo/icon_192.png" />
<link rel="apple-touch-icon-precomposed" sizes="192x192" href="logo/icon_192.png" />
<link rel="stylesheet" type="text/css" href="material-elements.css" />
<link rel="stylesheet" type="text/css" href="material-widgets.css" />
<link rel="stylesheet" type="text/css" href="material-depth.css" />
<link rel="stylesheet" type="text/css" href="material-dark.css" media="(prefers-color-scheme: dark)" id="dark-theme-import" />
<link rel="stylesheet" type="text/css" href="demo/fonts/roboto.css" />
<style type="text/css">
code {
padding: 2px 4px;
background-color: #dde3e6;
background-color: rgba(120, 142, 145, 0.25);
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
}
code.col,
.col > code {
padding: 16px;
}
h1 {
margin: 0 0 16px;
}
p {
margin: 16px 0;
}
nav ul {
list-style-type: '\2193';
}
footer {
margin-top: 2rem;
font-size: 80%;
text-align: center;
}
footer span {
display: inline-block;
}
.category-header,
.section {
margin-left: auto;
margin-right: auto;
max-width: 1200px;
}
.category-header {
margin-top: 8px;
margin-bottom: 8px;
}
.section h2 {
margin-top: 0;
}
.col {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 100%;
display: inline-block;
vertical-align: top;
margin: 16px 0 0;
}
@media (min-width: 600px) {
.section {
margin-top: 16px;
margin-bottom: 16px;
}
.col {
width: 49%;
max-width: 440px;
}
code.col {
max-width: none;
}
}
@media (min-width: 1000px) {
code.col {
width: calc(99% - 440px);
}
}
</style>
<!--[if lt IE 9]>
<script type="text/javascript">
document.createElement('header');
document.createElement('section');
</script>
<link rel="stylesheet" type="text/css" href="fix-old-ie.css" />
<style type="text/css">
header,
section {
display: block;
}
</style>
<![endif]-->
<script type="text/javascript">
if (navigator.userAgent.match(/Version\/[1-5]\..* Safari\//)) {
document.write('<link rel="stylesheet" type="text/css" href="fix-old-safari.css" />');
}
window.addEventListener('hashchange', function (ev) {
// If the browser supports JavaScript, correct for the
// app bar when scrolling to an element.
var APP_BAR_HEIGHT = 64;
var anchor = document.querySelector('a[name="' + location.hash.substring(1) + '"]');
if (anchor) {
anchor.scrollIntoView(true);
window.scrollBy(0, -APP_BAR_HEIGHT);
ev.preventDefault();
}
});
/** {HTMLLinkElement} The `link` that imports the dark theme style sheet */
var darkThemeImport,
/** {HTMLInputElement} The color picker for the accent color demo */
accentColorPicker,
/** {HTMLDivElement} The container for the accent color demo */
accentColorDemo,
/** {HTMLSpanElement} The part of the code sample that shows the selected accent color */
accentColorHex;
window.addEventListener('load', function () {
darkThemeImport = document.getElementById('dark-theme-import');
accentColorPicker = document.getElementById('accent-color-picker');
accentColorDemo = document.getElementById('accent-color-demo');
accentColorHex = document.getElementById('accent-color-hex');
accentColorPicker.addEventListener('input', handleAccentColorChange);
});
/**
* Set the dark theme for the page.
* @param {String} setting - Whether to turn the dark theme “off”, “on”, or or back to “system”
*/
function setDarkTheme(setting) {
switch (setting) {
case 'off':
if (darkThemeImport.parentElement) {
document.getElementsByTagName('head')[0].removeChild(darkThemeImport);
}
break;
case 'on':
if (!darkThemeImport.parentElement) {
document.getElementsByTagName('head')[0].appendChild(darkThemeImport);
}
darkThemeImport.media = 'all';
break;
case 'system':
if (!darkThemeImport.parentElement) {
document.getElementsByTagName('head')[0].appendChild(darkThemeImport);
}
darkThemeImport.media = '(prefers-color-scheme: dark)';
break;
}
}
/**
* Handle a newly selected accent color.
* @param {Event} ev
*/
function handleAccentColorChange(ev) {
accentColorDemo.style.setProperty('--mz-accent-color', ev.currentTarget.value);
accentColorHex.innerText = ev.currentTarget.value;
}
// Set up offline caching.
if (!!navigator.serviceWorker) {
navigator.serviceWorker.register('service_worker.js').then(function (registration) {
console.log('Registered service worker with scope:', registration.scope);
});
} else {
// If service worker is unavailable, fall back to app cache.
document.addEventListener('DOMContentLoaded', function () {
var appCacheIFrame = document.createElement('iframe');
appCacheIFrame.src = 'app_cacher.html';
appCacheIFrame.style.position = 'absolute';
appCacheIFrame.style.width = '1px';
appCacheIFrame.style.height = '1px';
appCacheIFrame.style.border = '0 none';
document.body.appendChild(appCacheIFrame);
});
}
</script>
<script type="text/javascript" src="material-touch.js"></script>
</head>
<body>
<header role="toolbar" class="appBar z2">
<span style="float: right;">
<button title="Action 1">
<img src="demo/icons/appbar1.png" alt="Action 1" />
</button>
<button title="Action 2">
<img src="demo/icons/appbar2.png" alt="Action 2" />
</button>
<button title="Action 3">
<img src="demo/icons/appbar3.svg" alt="Action 3" />
</button>
<button title="Button 4">
Action 4
</button>
</span>
MaterialZ
</header>
<p>
MaterialZ is a CSS library that implements the <a href="https://material.io/design/introduction/" target="_blank">Material Design spec</a>. Simply adding the stylesheets introduces a base coat of Material theming. With a few tweaks, other widgets, such as app bars, lists, and cards, can be added. MaterialZ is designed to be a low-effort “it just works” alternative to other Material Design libraries, trading advanced customization options for minimizing complexity.
<br />
<br />
<a href="https://github.com/zmyaro/materialz" target="_blank">Get it on GitHub ⭷</a>
</p>
<nav>
<ul>
<li>
<a href="#elements">Elements</a>
<ul>
<li><a href="#headings">Headings</a></li>
<li><a href="#kbd">Keyboard shortcuts</a></li>
<li><a href="#buttons">Buttons</a></li>
<li><a href="#radios">Radio buttons</a></li>
<li><a href="#checkboxes">Checkboxes</a></li>
<li><a href="#selects">Drop-down menus</a></li>
<li><a href="#textfields">Text fields</a></li>
<li><a href="#sliders">Sliders</a></li>
<li><a href="#progress">Progress bars</a></li>
</ul>
</li>
<li>
<a href="#widgets">Widgets</a>
<ul>
<li><a href="#lists">Lists</a></li>
<li><a href="#toolbars">Toolbars</a></li>
<li><a href="#appbars">App bars</a></li>
<li><a href="#cards">Cards</a></li>
<li><a href="#circularprogress">Circular progress indicators</a></li>
<li><a href="#switches">Toggle switches</a></li>
</ul>
</li>
<li><a href="#depth">Depth</a></li>
<li><a href="#responsive">Responsive design</a></li>
<li><a href="#darktheme">Dark theme</a></li>
<li><a href="#accentcolor">Accent color</a></li>
</ul>
</nav>
<a name="elements"></a>
<br />
<header class="category-header">
<h1>Elements</h1>
<p>Adding the <code>material-elements.css</code> style sheet will automatically style the following elements. That style sheet works based on standard HTML elements and attributes, so it can work without adding additional classes other frameworks without CSS classes clashing.</p>
</header>
<a name="headings"></a>
<section class="section card full-width z1">
<h2>Headings</h2>
<p>The top three levels of headings have been styled according to the heading, title, and subhead styles in the <a href="http://www.google.com/design/spec/style/typography.html#typography-styles" target="_blank">Material Design guidelines</a>.</p>
<div class="col">
<h1>Headline</h1>
<h2>Title</h2>
<h3>Subhead</h3>
</div>
<code class="col">
<h1>Headline</h1>
<br />
<h2>Title</h2>
<br />
<h3>Subhead</h3>
</code>
</section>
<a name="kbd"></a>
<section class="section card full-width z1">
<h2>Keyboard shortcuts</h2>
<p>While there is no official design spec, the <code><kbd></code> element has formatting similar to keyboard hints in some of Google's Material Design apps.</p>
<div class="col">
Reload the page with <kbd>Ctrl</kbd>+<kbd>R</kbd>.
</div>
<code class="col">
Reload the page with <kbd>Ctrl</kbd>+<kbd>R</kbd>.
</code>
</section>
<a name="buttons"></a>
<section class="section card full-width z1">
<h2>Buttons</h2>
<!--[if lt IE 9]>
<p>
(Older IE has a bug with raised element inside of raised elements, so you need to toggle the elevation of this section to see the raised buttons.
<button onclick="parentElement.parentElement.className = (parentElement.parentElement.className === 'section card full-width z1' ? 'section card full-width' : 'section card full-width z1');">
Toggle
</button>)
</p>
<![endif]-->
<p>Any <code><button></code> element, any <code><input></code> with <code>type</code> set to <code>button</code>, <code>submit</code>, or <code>reset</code>, or any other element with <code>role="button"</code> will automatically be styled as a flat paper button. Adding a depth class will turn it into a raised button (see <a href="#depth">Depth</a> below).</p>
<div class="col">
<button>Button</button>
<button class="z1">Raised button</button>
<br />
<button disabled="disabled">Disabled button</button>
<button class="z1" disabled="disabled">Disabled raised button</button>
<br />
<input type="button" value="Input button" />
<input type="button" class="z1" value="Raised input button" />
<br />
<div role="button">Div button</div>
<div role="button" class="z1">Raised div button</div>
</div>
<code class="col">
<button>Button</button>
<br />
<button class="z1">Raised button</button>
<br />
<br />
<button disabled="disabled">Disabled button</button>
<br />
<button class="z1" disabled="disabled">Disabled raised button</button>
<br />
<br />
<input type="button" value="Input Button" />
<br />
<input type="button" class="z1" value="Raised input button" />
<br />
<br />
<div role="button">Div Button</div>
<br />
<div role="button" class="z1">Raised Div Button</div>
</code>
</section>
<a name="radios"></a>
<section class="section card full-width z1">
<h2>Radio buttons</h2>
<p>An <code><input type="radio" /></code> will be styled and animated as a paper radio button. (Note this is only fully supported in WebKit- and Blink-based browsers, such as Chrome and Safari.)</p>
<div class="col">
<input type="radio" name="radioset1" />
<input type="radio" name="radioset1" checked="checked" />
<input type="radio" name="radioset2" disabled="disabled" />
<input type="radio" name="radioset2" checked="checked" disabled="disabled" />
</div>
<code class="col">
<input type="radio" name="radioset1" />
<br />
<input type="radio" name="radioset1" checked="checked" />
<br />
<input type="radio" name="radioset2" disabled="disabled" />
<br />
<input type="radio" name="radioset2" checked="checked" disabled="disabled" />
</code>
</section>
<a name="checkboxes"></a>
<section class="section card full-width z1">
<h2>Checkboxes</h2>
<p>An <code><input type="checkbox" /></code> will be styled and animated as a paper checkbox. (Note this is only fully supported in WebKit- and Blink-based browsers, such as Chrome and Safari.)</p>
<div class="col">
<input type="checkbox" />
<input type="checkbox" checked="checked" />
<input type="checkbox" disabled="disabled" />
<input type="checkbox" checked="checked" disabled="disabled" />
</div>
<code class="col">
<input type="checkbox" />
<br />
<input type="checkbox" checked="checked" />
<br />
<input type="checkbox" disabled="disabled" />
<br />
<input type="checkbox" checked="checked" disabled="disabled" />
</code>
</section>
<a name="selects"></a>
<section class="section card full-width z1">
<h2>Drop-down menus</h2>
<p>A simple <code><select></code> element will be styled as a paper drop-down menu.</p>
<div class="col">
<select>
<option>Lorem</option>
<option>Ipsum</option>
<option>Dolor</option>
<option>Sit</option>
<option>Amet</option>
</select>
</div>
<code class="col">
<select>
<br />
<option>Lorem</option>
<br />
<option>Ipsum</option>
<br />
<option>Dolor</option>
<br />
<option>Sit</option>
<br />
<option>Amet</option>
<br />
</select>
</code>
</section>
<a name="textfields"></a>
<section class="section card full-width z1">
<h2>Text fields</h2>
<p>Any <code><input /></code> with <code>type</code> set to <code>search</code>, <code>password</code>, <code>email</code>, <code>url</code>, <code>tel</code> or <code>number</code> will be styled as a paper text field. Date/time pickers <code>date</code>, <code>datetime-local</code>, <code>month</code>, <code>time</code>, or <code>week</code> will as well.</p>
<div class="col">
<input type="text" placeholder="Text field" />
<br />
<input type="number" value="10" />
<br />
<input type="date" value="1969-12-31" placeholder="Date picker" />
<br />
<input type="datetime-local" value="1969-12-31T23:59:59" placeholder="Date/time picker" />
<br />
<input type="month" value="1969-12" placeholder="Month picker" />
<br />
<input type="time" value="23:59" placeholder="Time picker" />
<br />
<input type="week" value="1969-W52" placeholder="Week picker" />
</div>
<code class="col">
<input type="text" placeholder="Text field" />
<br />
<input type="number" value="10" />
<br />
<input type="date" />
<br />
<input type="datetime-local" />
<br />
<input type="month" />
<br />
<input type="time" />
<br />
<input type="week" />
</code>
</section>
<a name="sliders"></a>
<section class="section card full-width z1">
<h2>Sliders</h2>
<p>Any <code><input type="range" /></code> will be styled as a paper slider.</p>
<div class="col">
<input type="range" />
<input type="range" disabled="disabled" />
</div>
<code class="col">
<input type="range" />
<br />
<input type="range" disabled="disabled" />
</code>
</section>
<a name="progress"></a>
<section class="section card full-width z1">
<h2>Progress bars</h2>
<p>Any <code><progress></code> element will be styled as a paper progress bar.</p>
<div class="col">
<progress value="0.5"></progress>
</div>
<code class="col">
<progress value="0.5"></progress>
</code>
</section>
<a name="widgets"></a>
<br />
<header class="category-header">
<h1>Widgets</h1>
<p>Adding the <code>material-widgets.css</code> style sheet will allow the following widgets to be added.</p>
</header>
<a name="lists"></a>
<section class="section card full-width z1">
<h2>Lists</h2>
<p>An <code><ol></code> or <code><ul></code> with the <code>list</code> class will have its list items and buttons styled.</p>
<div class="col">
<ul class="list">
<li>Item 1</li>
<li>Item 2</li>
<li><button style="width: 100%; width: calc(100% + 32px);">Button</button></li>
<li><div role="button">Div button</button></li>
</ul>
</div>
<code class="col">
<ul class="list">
<br />
<li>Item 1</li>
<br />
<li>Item 2</li>
<br />
<li><button>Button</button></li>
<br />
<li><div role="button">Div button</button></li>
<br />
</ul>
</code>
</section>
<a name="toolbars"></a>
<section class="section card full-width z1">
<h2>Toolbars</h2>
<p>An element with <code>role="toolbar"</code> will have its buttons styled as paper toolbar buttons. Icons will be resized to 24px, so SVGs and 2x PNGs may be used.</p>
<div class="col">
<div role="toolbar">
<button title="Action 1">
<img src="demo/icons/toolbar1.png" alt="Action 1" />
</button>
<button title="Action 2">
<img src="demo/icons/toolbar2.png" alt="Action 2" />
</button>
<button title="Action 3">
<img src="demo/icons/toolbar3.svg" alt="Action 3" />
</button>
<button title="Action 4">
Action 4
</button>
</div>
</div>
<code class="col">
<div role="toolbar">
<br />
<button title="Action 1">
<br />
<img src="icon1.png" alt="Action 1" />
<br />
</button>
<br />
<button title="Action 2">
<br />
<img src="icon2.png" alt="Action 2" />
<br />
</button>
<br />
<button title="Action 3">
<br />
<img src="icon3.svg" alt="Action 3" />
<br />
</button>
<br />
<button title="Action 4">
<br />
Action 4
<br />
</button>
<br />
</div>
</code>
</section>
<a name="appbars"></a>
<section class="section card full-width z1">
<h2>App bars</h2>
<p>An element (usually a <code><header></code>) with the <code>appBar</code> class will be styled as an app bar—fixed to the top of the page, and set to be 64px tall on larger screens and 56px tall on smaller screens. An app bar can be a toolbar as well by adding <code>role="toolbar"</code>. A depth class can be added to visually raise button the app bar above other content (see <a href="#depth">Depth</a> below).</p>
<div class="col">
[See the app bar at the top of the screen for an example.]
</div>
<code class="col">
<header role="toolbar" class="appBar">
<br />
<span style="float: right;">
<br />
<button title="Action 1">
<br />
<img src="icon1.png" alt="Action 1" />
<br />
</button>
<br />
<button title="Action 2">
<br />
<img src="icon2.png" alt="Action 2" />
<br />
</button>
<br />
<button title="Action 3">
<br />
<img src="icon3.svg" alt="Action 3" />
<br />
</button>
<br />
<button title="Action 4">
<br />
Action 4
<br />
</button>
<br />
</span>
<br />
<br />
Title text
<br />
</header>
</code>
</section>
<a name="cards"></a>
<section class="section card full-width z1">
<h2>Cards</h2>
<p>An element with the <code>card</code> class will be styled as a paper card. Add a <a href="#depth">depth</a> class to determine how high to visually raise the card. A <code>card</code> with the <code>full-width</code> class as well will have “auto” left and right margins, and will fill the entire window width in <a href="#responsive">narrow windows</a>. (Each of these sections is a <code><section class="card full-width z1"></code>.)</p>
<div class="col">
<div class="card z1" style="width: 192px; height: 192px;"></div>
</div>
<code class="col">
<div class="card z1" style="width: 192px; height: 192px;"></div>
</code>
</section>
<a name="circularprogress"></a>
<section class="section card full-width z1">
<h2>Circular progress indicators</h2>
<p>A progress (or <code>role="progress"</code>) element with the <code>circular</code> class will be styled as a circular progress indicator. Change the <code>color</code> to change the color of the spinner.</p>
<div class="col">
<progress class="circular"></progress>
<progress class="circular" style="width: 32px; height: 32px;"></progress>
<progress class="circular" style="color: #2196f3;"></progress>
</div>
<code class="col">
<progress class="circular"></progress>
<br />
<progress class="circular" style="width: 32px; height: 32px;"></progress>
<br />
<progress class="circular" style="color: #2196f3;"></progress>
</code>
</section>
<a name="switches"></a>
<section class="section card full-width z1">
<h2>Toggle switches</h2>
<p>A checkbox with the <code>switch</code> class will be styled as a toggle switch. When toggled on, the switch will be the current <code>color</code>.</p>
<div class="col">
<input type="checkbox" class="switch" />
<input type="checkbox" class="switch" checked="checked" />
<br />
<br />
<input type="checkbox" class="switch" disabled="disabled" />
<input type="checkbox" class="switch" checked="checked" disabled="disabled" />
<br />
<br />
<input type="checkbox" class="switch" checked="checked" style="color: #f44336;" />
<input type="checkbox" class="switch" checked="checked" disabled="disabled" style="color: #f44336;" />
</div>
<code class="col">
<input type="checkbox" class="switch" />
<br />
<input type="checkbox" class="switch" checked="checked" />
<br />
<br />
<input type="checkbox" class="switch" disabled="disabled" />
<br />
<input type="checkbox" class="switch" checked="checked" disabled="disabled" />
<br />
<br />
<input type="checkbox" class="switch" checked="checked" style="color: #f44336;" />
<br />
<input type="checkbox" class="switch" checked="checked" disabled="disabled" style="color: #f44336;" />
</code>
</section>
<a name="depth"></a>
<br />
<header class="category-header">
<h1>Depth</h1>
<p>Adding the <code>material-depth.css</code> style sheet enables depth classes <code>z1</code> through <code>z5</code>, which add shadows to elements.</p>
</header>
<section class="section card full-width z1">
<h2>Depth classes</h2>
<p>An element with any of the five z-depth classes will have a shadow applied to it. A <a href="#buttons">button</a> with a depth class applied will function as a raised button. A <a href="#cards">card</a> with a depth class applied will also be lightened as appropriate for its elevation in <a href="#darktheme">dark theme</a>.</p>
<div class="col">
<div class="card z1" style="width: 256px;">
z = 1
</div>
<br />
<div class="card z2" style="width: 256px;">
z = 2
</div>
<br />
<div class="card z3" style="width: 256px;">
z = 3
</div>
<br />
<div class="card z4" style="width: 256px;">
z = 4
</div>
<br />
<div class="card z5" style="width: 256px;">
z = 5
</div>
</div>
<code class="col">
<div class="card z1" style="width: 256px;">
<br />
z = 1
<br />
</div>
<br />
<br />
<div class="card z2" style="width: 256px;">
<br />
z = 2
<br />
</div>
<br />
<br />
<div class="card z3" style="width: 256px;">
<br />
z = 3
<br />
</div>
<br />
<br />
<div class="card z4" style="width: 256px;">
<br />
z = 4
<br />
</div>
<br />
<br />
<div class="card z5" style="width: 256px;">
<br />
z = 5
<br />
</div>
</code>
</section>
<a name="responsive"></a>
<br />
<header class="category-header">
<h1>Responsive design</h1>
<p>MaterialZ automatically adjusts a few things in narrow windows.</p>
</header>
<section class="section card full-width z1">
<h2>Narrow window changes</h2>
<p>In a window <strong>≤ 600px</strong> wide, MaterialZ makes the following adjustments:</p>
<ul>
<li>Body padding reduces by 8px.</li>
<li>Full-width <a href="#cards">cards</a> expand to fill the window width and remove their rounded corners.</li>
</ul>
<small>As of the current version of MaterialZ, the 600px breakpoint cannot be configured, however you can find/replace “600px” in the MaterialZ CSS files to change the breakpoint. This will be configurable in a future version of MaterialZ.</small>
</section>
<a name="darktheme"></a>
<br />
<header class="category-header">
<h1>Dark theme</h1>
<p>Adding the <code>material-dark.css</code> style sheet overrides the default (light) Material styles to standard Material dark theme.</p>
</header>
<section class="section card full-width z1">
<h2>Dark theme setting</h2>
<p>The easiest way to let the user choose a theme is to add a <code>(prefers-color-scheme: dark)</code> media query to the import, which will automatically load it if the user's system theme is set to dark. (This page does that.) At time of writing, this is supported on the latest versions of all major browsers on the latest versions of Android, iOS, MacOS, and Windows.</p>
<code style="display: block;">
<link rel="stylesheet" type="text/css" href="material-dark.css" media="(prefers-color-scheme: dark)" />
</code>
<p>You can also include/exclude the import based on a user setting.</p>
<button onclick="setDarkTheme('on');">Force dark theme on</button>
<button onclick="setDarkTheme('off');">Force dark theme off</button>
<button onclick="setDarkTheme('system');">Use system preference (if supported)</button>
<p>You can, of course, not include a light/dark theme option, but that is generally not recommended.</p>
<p>See also: <a href="" target="_blank">Material dark theme guidelines ⭷</a></p>
</section>
<a name="accentcolor"></a>
<br />
<header class="category-header">
<h1>Accent color</h1>
<p>If you only need to support browsers that support CSS custom properties, you can specify a single accent color.</p>
</header>
<section class="section card full-width z1">
<h2>Accent color property</h2>
<p>Instead of individually overriding the colors of elements, set the <code>--mz-accent-color</code> property. Do keep in mind older browsers will ignore your custom property.</p>
<!--<iframe src="demo/accent_color.html" class="col"><a href="demo/accent_color.html">Demo</a></iframe>-->
<div class="col" id="accent-color-demo" style="--mz-accent-color: #f44336;">
<input type="radio" name="accent-radio" />
<input type="radio" name="accent-radio" checked="checked" />
<br />
<input type="checkbox" />
<input type="checkbox" checked="checked" />
<br />
<input type="checkbox" class="switch" />
<input type="checkbox" class="switch" checked="checked" />
<br />
<input type="text" placeholder="Text field" />
<br />
<input type="range" />
<br />
<progress value="0.5"></progress>
<br />
<progress class="circular"></progress>
</div>
<div class="col">
<code style="display: block;">
:root {
<br />
--mz-accent-color: <span id="accent-color-hex">#f44336</span>;
<br />
}
</code>
<br />
<label>
Change the accent color:
<input type="color" id="accent-color-picker" value="#f44336" />
</label>
</div>
<br />
<br />
<small>If you want to customize the accent color in <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/--*#browser_compatibility" target="_blank">browsers that do not support CSS custom properties⭷</a>, you can find/replace “#40c4ff” in the MaterialZ CSS files to change the accent color.</small>
</section>
<footer>
<p>
<span>©2015-2021</span>
·
<span>Created by <a href="https://zmyaro.com" target="_blank">Zachary Yaro</a></span>
·
<span><a href="https://github.com/ZMYaro/materialz" target="_blank">Source code</a></span>
·
<span><a href="https://patreon.com/ZMYaro">Support my work</a></span>
·
<span><a href="https://material.io/design/introduction" target="_blank">Google's Material Design spec</a></span>
</p>
</footer>
</body>
</html>